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

Barrett Golding bg at hearingvoices.com
Mon Oct 4 19:39:16 UTC 2010


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/>
~radio active transmissions~





More information about the wp-hackers mailing list