Loading jQuery - Loading Latest jQuery - Test If jQuery Loaded
Below we explain several ways to install jQuery on your website:
- Have your web page load the latest version from a CDN (content delivery network) like jQuery.com
- Download the latest jQuery file, copy it to your web server, and load it locally.
Is jQuery Loaded On Your Site Already?
If you are using software like WordPress, or a content management system or development platform, or even a design template or theme you purchased, there's a good chance it already is loading jQuery because it is using it. You only need to load jQuery once so it's wise to create a test page to see if jQuery is already loaded. In the test page paste this script, then view the page in your browser. A popup message will tell you if you already have jQuery loaded or not.
<script type="text/javascript">
if (typeof jQuery == 'undefined') {
alert('jQuery is not loaded')
} else {
alert('jQuery is already loaded')
}
</script>
Loading Latest jQuery from jQuery.com
The following loads the latest version of jQuery from jQuery.com when you place this in your web page <head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js" charset="utf-8"></script>
An advantage to loading this way is your web visitors may already have visited another site that loaded jQuery this way, in which case their browser will immediately use the copy already on their PC instead of wasting time downloading the file if you host it on your web site. This means your site loads faster.
Loading jQuery from Your Web Server
You can download jQuery here: jQuery.com.
Place the file in a folder on your own web server such as within /js and then include a load command in your web page <head> with a path to your copy:
<script type="text/javascript" src="/js/jquery.js" charset="utf-8"></script>
Loading jQuery Only If It's Not Already Loaded
Here's a clever way to automatically load jQuery only if it isn't already loaded. I use this when distributing software or design themes and I won't know if jQuery already exists or not. This version will load the latest version if there is no version of jQuery already running...
<script type="text/javascript"> if (window.jQuery == undefined) document.write( unescape('%3Cscript src="/js/jquery-1.6.4.min.js" type="text/javascript"%3E%3C/script%3E') );</script>
- Trackback Link
- http://www.atlantawebdesignga.com/BlogRetrieve.aspx?BlogID=11204&PostID=328470&A=Trackback
- Trackbacks
- Post has no trackbacks.
Recent Posts
- Require Minimum Order Amount or Product Quantities in an Adobe Business Catalyst Shopping Cart
- Automatically Format Images with jQuery - Add Margins, Borders, More
- Loading jQuery - Loading Latest jQuery - Test If jQuery Loaded
- Use JavaScript Galleria Slideshow to Display an Adobe Business Catalyst Photo Gallery using jQuery
- Sneak Preview Video: Adobe Business Catalyst V3 Version 3 Lets a Web Developer Design Anything Using Liquid Markup
- Migrating A Site into Adobe Business Catalyst with Proper Google Redirects
- Use a Link to Submit A Web App Search Results Page in Adobe Business Catalyst
- Improving Search Engine Optimization on Adobe Business Catalyst
- Make Main Product Image Link to Poplets Thumbnail Slide Show in Adobe Business Catalyst
- Make Product Thumbnail Images Link To Product Detail Pages in Adobe Business Catalyst with jQuery
Tags
- Adobe Business Catalyst (10)
- Business Catalyst (3)
- CSS (1)
- E-commerce (1)
- Galleria (1)
- Import Site (1)
- JQuery (8)
- Liquid Markup (1)
- Photo Gallery (1)
- Plug-Ins (1)
- Poplets (1)
- Product Image (1)
- Search Engine Optimization (2)
- SEO (2)
- Shopping Cart (3)
- Slide Show (2)
- Thumbnails (2)
- V3 (1)
- Version 3 (1)
- Web Apps (1)
Comments
Post has no comments.