Reputation: 8241
I have used the Google CDN for referencing the jquery files for my application.
<script type="text/javascript" language="Javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
Usage of the above helped me a lot in increasing the performance of the application. The main advantage of the CDN reference is as mentioned below:
The browser behavior is that whenever it loads any webpage, it keeps related files (eg. Javascript file, CSS file and Images) used for that page into its cache (also called history). When next time the user browses any web page, browser loads only those files that are new or modified and is not available in the browser cache or history. In this way, browser improves its performance and loads the page.
But since the caching is per domain, how can it manage Javascript file, CSS file and Images in this case. Will it be a problem in case of cross domain browsing by the end user.
Can anyone help me out to understand more details about the above issue.
Thanks & Regards, Santosh Kumar Patro
Upvotes: 0
Views: 608
Reputation:
It will just cache them with the given URL and any page requesting the same file from the same url can use it, even across different domains - Google made a big thing a couple of years ago about including JQuery in their main search page, in the exact same manner as they require other CDN users to do it, so that the vast majority of people already had their CDN version of JQuery available.
Something else to look into if you want to start using CDNs is "protocol independent urls" - let the browser select the right protocol (https or http) depending on the protocol of the current page, so you avoid "some items on this page are not secure" errors.
URI starting with two slashes ... how do they behave?
Upvotes: 1