3

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.

Thanks,

1 Answer 1

3

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).

2
  • Also, accidentally using an auto update CDN link can result in code breaks when incompatible changes to an API are introduced.
    – sfdcfox
    Commented Jun 29, 2014 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
    Commented Jun 29, 2014 at 10:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .