@@ -23,7 +23,7 @@ Loading jQuery
23
23
In order to use jQuery, you have to download it first and place it in the
24
24
static folder of your application and then ensure it's loaded. Ideally
25
25
you have a layout template that is used for all pages where you just have
26
- to add a script statement to your `head ` to load jQuery:
26
+ to add a script statement to the bottom of your `<body> ` to load jQuery:
27
27
28
28
.. sourcecode :: html
29
29
@@ -35,15 +35,15 @@ Another method is using Google's `AJAX Libraries API
35
35
36
36
.. sourcecode :: html
37
37
38
- <script type=text/javascript
39
- src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
38
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js"></script>
39
+ <script>window.jQuery || document.write('<script src="{{
40
+ url_for('static', filename='jquery.js') }}">\x 3C/script>')</script>
40
41
41
- In this case you don't have to put jQuery into your static folder, it will
42
- instead be loaded from Google directly. This has the advantage that your
42
+ In this case you have to put jQuery into your static folder as a fallback, but it will
43
+ first try to load it directly from Google. This has the advantage that your
43
44
website will probably load faster for users if they went to at least one
44
45
other website before using the same jQuery version from Google because it
45
- will already be in the browser cache. Downside is that if you don't have
46
- network connectivity during development jQuery will not load.
46
+ will already be in the browser cache.
47
47
48
48
Where is My Site?
49
49
-----------------
0 commit comments