Google CDN Hosted jQuery UI CSS with local backup?

I already have the following JS files:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <script type="text/javascript">!window.jQuery && document.write(unescape("%3Cscript src='/app_shared/script/jquery-1.6.1.min.js' type='text/javascript'%3E%3C/script%3E"))</script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js"></script> <script type="text/javascript">!window.jQuery.ui && document.write(unescape("%3Cscript src='/app_shared/script/jquery-ui.min.js' type='text/javascript'%3E%3C/script%3E"))</script> 

How can I find something similar for the theme? I can download it from cdn as follows:

 <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> 

But how can I determine if a file was uploaded to refer to a local copy on error? I know how to add a local copy programmatically using jQuery, but I do not know how to check if CSS loading was done. Also, block tag tags <link> , or are they async? This will also be a problem.

+7
source share
2 answers

You can check the style in which the font must be a specific family, and then check that name. If the name does not match what you expected, download a local copy.

0
source

You can also try something like Get CSS value from an external stylesheet using Javascript / jQuery

 <style> p {color: blue} </style> $(document).ready(function() { var $p = $("<p></p>").hide().appendTo("body"); alert($p.css("color")); $p.remove(); }); 
0
source

All Articles