I am just curious to understand if there is any difference in page performance between referencing a js library from static resource inside of Salesforce or referencing from a hosted server in a Visualforce page (just like this, http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js) ? For instance as just given in this article,

Referencing the Force.com Canvas SDK

Any thoughts please.



The request is being made from the client to a server in both cases, so the question is which server will return the data quickest which is hard to know.

A (theoretical) advantage of using a CDN location is that a user's browser may already have a copy of the file cached because of some other web. But given that different web pages are likely to be using different versions of things like jQuery I doubt that this happens very often.

The benefit of serving the file from Salesforce is that then all the content for your application is coming from one hosting company - Salesforce - that hopefully your customer trusts. Using a CDN adds a second hosting company to the mix and so more risk (of a security breach resulting in the content being hacked).

  • Also, accidentally using an auto update CDN link can result in code breaks when incompatible changes to an API are introduced.
    – sfdcfox
    Jun 29 '14 at 4:24
  • @sfdcfox Wasn't aware of such a mechanism - fair point. Some more discussion of why to avoid: Latest jQuery version on Google's CDN.
    – Keith C
    Jun 29 '14 at 10:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.