Wednesday, September 28, 2011

Why using jQuery from Google's AJAX API

Intro
Hi, Dear visitor.
As you noticed huge amount of web resources using jQuery directly from Google's Ajax API.
In the next article i will explain the advantages of such tactics as additional to Web FrondEnd Optimization, Frontend Optimization will not be covered in current article, but i will write about this in one of my next articles, pehaps it gonna happen at 30 or 31 Sept. 2011

How to use it?
It is very easy, just include into end of template (before ) before body closes next line.

There also available other popular frameworks such as mootools, prototype, scriptaculous, jqueryUI and others to find a link take a look at: Google's Ajax API
Now Let's we move to the next step...
Why it is preferred way to include jQuery from Google's AJAX API ?
So why would you ask. The answer is in advantages of such tactic.
1) Loading time... 1.1) The loading time may be slightly increased for a lot of visitors of your website, as a lot of website's using google's jquery the visitor may come to you with already cached jQuery, so that he dont need to load it again and his browser knows about this.
1.2) You servers may not be fast enough to load jQuery as fast as google or in bounch of images and data it is loading jquery lib a long time. 1.3) Separating domains to load page elements from also speed incresing. i will cover this aspect in next articles.

What means // rather than http:// or https:// and why do you use it like that?
Double slash ahead rather than exactly defined protocol means that linked element will be server from automacally matched protocol, such as if visitor currently visiting your website on HTTPS, the file will be included as https and not causing problem as serving from http while loading through https. http and https web optimization to not bug your pages will also be covered in next article.
Overall i can say this will bug your page and tell visitor that it is not compatible with secure protocol or something like that, depens on visitor's browser.

No comments: