0

I have a page that uses jQuery UI. Ideally I would like to use the google cached version if possible, but if that was unavailable I would like to fall back on a local version.

Is this possible? I have been hunting through the html <script> tag reference but cant find anything to do a check and fallback.

1

2 Answers 2

2

You can do something like this (while of course changing the URLs to suit your needs):

<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script> <script>window.jQuery.ui || document.write('<script src="/libs/jquery-ui.js"><\/script>');</script> 
Sign up to request clarification or add additional context in comments.

Comments

1

This was answered before: Best way to use Google's hosted jQuery, but fall back to my hosted library on Google fail

The same applies for jQueryUI ofcourse.

<script src="/path/to/external/jqueryui"></script> <script> if (!window.jQuery.ui) { document.write('<script src="/path/to/local/jqueryui"><\/script>'); } </script> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.