Because Google is currently unstable and there is no similar service in China, it is no longer the best solution. Of course, you can still use this method to change the Google library path to a stable and fast path in China (if any. Even so, Google is the best choice for comprehensive consideration.
Although Google CDN's jQuery library is quickly loaded in website development projects, it is safe to call the local server library. If you use the Wordpress built-in jQuery library, the end of the jQuery library is added to prevent JS library conflicts. noConflict () makes some minor modifications to all jQuery code in the topic, which may render some plug-ins ineffective. I think the method Paul Irish uses in HTML5 Boilerplate is very good and I will share it with you.
Usage
Use the following code to load the local jQuery library when the Google CDN library fails to be obtained:Copy codeThe Code is as follows: <script type = "text/javascript" src = "// ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"> </script>
<Script type = "text/javascript"> window. jQuery | document. write ('<script type = "text/javascript" src = "/js/libs/jquery. min. js "> \ x3C/script> ') </script>
The method used in the Wordpress topic is:Copy codeThe Code is as follows: <script type = "text/javascript" src = "// ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"> </script>
<Script type = "text/javascript"> window. jQuery | document. write ('<script type = "text/javascript" src = "<? Php echo get_template_directory_uri ();?> /Jquery. min. js "> \ x3C/script> ') </script>
Notes
We recommend that you download the official jQuery Min library and put it in the topic directory currently used by Wordpress. Do not use the library in wp-DES.
The address of the Google CDN library uses the protocol relative path, which can solve some problems caused by https. For details, refer to Paul Irish's introduction. Of course, you can still use the "http:.
Many websites use the jQuery library provided by Google CDN to achieve excellent cache performance.
Placing all jQuery code at the bottom of the page can increase the loading speed.
You can omit type = "text/javascript" for pages reconstructed using HTML5 ".
Use SAE developer Resources
Due to some recent problems with Google services, it is a good way to use SAES developer resources to increase the traffic speed. SAE is the developer resource provided by Sina for its applications, where there is a jQuery library. It is very easy to use, as long as you find the appropriate address in the SAE Developer Center and replace the Google CDN address of the above Code. For example:Copy codeThe Code is as follows: <script type = "text/javascript" src = "// lib.sinaapp.com/js/jquery/1.5.2/jquery.min.js"> </script>
<Script type = "text/javascript"> window. jQuery | document. write ('<script type = "text/javascript" src = "/js/libs/jquery. min. js "> \ x3C/script> ') </script>