[wp-hackers] google jquery; wp fall back?

Milan Dinić liste at srpski.biz
Mon Oct 4 20:29:35 UTC 2010


For use of Google-hosted jQuery, best and full-featured solution for
WordPress is Use Google Libraries plugin. The only thing that it lacks is
fall back.

You can see how it handles noconflict to maybe get idea how to add fall
back.

2010/10/4 Barrett Golding <bg at hearingvoices.com>

> tried asking this in support, but no takers,
> so hope it's ok to ask here...
>
> the following is a rewite for WP of the code at:
> http://html5boilerplate.com/
> it grabs Google's CDN vers of jquery, but falls back to a local copy--
> for the few times when (and few countries where) Google is unavailable.
>
> <?php wp_enqueue_script( 'jquery' ); ?>
> <script type="application/x-javascript">!window.jQuery &&
> document.write('<script
> src="/wp-includes/js/jquery/jquery.js"><\/script>')</script>
>
> i've de-/re- registered 'jquery' so it gets Google's vers,
> and above works fine inserted in <head> (of header.php, for instance):
>
> one slight prob is if above <script> is in footer.php,
> the fall back fails. otherwise, all seems to work well.
>
> so, I'm just wondering if anyone has a better solution,
> or sees some flaw in mine. thanks.
> bg
> --
> <http://HearingVoices.com/ <http://hearingvoices.com/>>
> ~radio active transmissions~
>
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list