function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rajneesh Ranjan 23Rajneesh Ranjan 23 

Why we use Static Resource in Visualforce Markup? Why we do not use "Documents folder" for resources

Can any one please explain, why we use "Static Resource" in VF Markup to display images and to link other elements like CSS and JS files. Why we do not place these components in "Document" folder and use it on a VF page. What all advantages are there if we use Static Resource.

Thanks in advance..!!

Regards,
Rajneesh
Best Answer chosen by Rajneesh Ranjan 23
RatanRatan
Typically, static resources is used for files that will need to be transferred between orgs. Often, images are put here that are used within code, Javascript, CSS, or documents that code might reference.

Documents is meant as a reference for the typical end Users to use when necessary. This does not transfer between orgs.

Note that if you want to make say an image used in a HTML template available to the unauthenticated recipient of the email then you must use a Document as described in How do I reference a public image stored in salesforce.com in my HTML?. (http://help.salesforce.com/apex/HTViewSolution?id=000005050&language=en_US

Short answer, if you are using it for a check mark image that will be used in a field, this needs to go between orgs and so I would use a static resource if possible.

Source: http://salesforce.stackexchange.com/questions/40103/when-to-use-static-resource-vs-documents

Also check what is the difference between static resource and document (https://success.salesforce.com/answers?id=90630000000gr7bAAA).

Static Resource vs Document (http://theblogreaders.com/static-resource-vs-document/#.VrdWwhh97IV)

All Answers

RatanRatan
Typically, static resources is used for files that will need to be transferred between orgs. Often, images are put here that are used within code, Javascript, CSS, or documents that code might reference.

Documents is meant as a reference for the typical end Users to use when necessary. This does not transfer between orgs.

Note that if you want to make say an image used in a HTML template available to the unauthenticated recipient of the email then you must use a Document as described in How do I reference a public image stored in salesforce.com in my HTML?. (http://help.salesforce.com/apex/HTViewSolution?id=000005050&language=en_US

Short answer, if you are using it for a check mark image that will be used in a field, this needs to go between orgs and so I would use a static resource if possible.

Source: http://salesforce.stackexchange.com/questions/40103/when-to-use-static-resource-vs-documents

Also check what is the difference between static resource and document (https://success.salesforce.com/answers?id=90630000000gr7bAAA).

Static Resource vs Document (http://theblogreaders.com/static-resource-vs-document/#.VrdWwhh97IV)
This was selected as the best answer
Rajneesh Ranjan 23Rajneesh Ranjan 23
Thank you so much Ratan.. It was very helpful.. :)