Static Resources

Static resources are containers for content used in Visualforce pages that does not change. Examples of unchanging content include images, stylesheets, and JavaScript files. Although any service that allows storage of URL-accessible data can perform a similar role, static resources have the benefit of being tightly integrated with the Visualforce page. Their names are validated when the page is compiled, preventing the creation of a page that refers to an invalid static resource. They are also inaccessible to anonymous public Internet users. Users not authenticated to your Salesforce organization cannot load your static resources unless you explicitly allow it using Force.com Sites.

A static resource can be a single file or a zip archive consisting of many files. The maximum size of a single static resource is 5MB, and no more than 250MB of static resources can be defined in any single Force.com organization.

To create a new static resource, follow these steps:

1. In the App Setup area, click Develop, Static Resources.

2. Click the New button to add a new static resource.

3. Enter a name for the static resource. The name cannot contain spaces or other nonalphanumeric characters, must begin with a letter, and must be unique. The name is used to refer to the static resource in Visualforce pages.

4. Specify an optional description to explain the purpose of this static resource to other users.

5. Click the Browse button to find a file in your file system to provide the content for the static resource.

6. Leave the Cache Control setting at its default value, Private. This setting is discussed later in the “Introduction to Force.com Sites” subsection.

7. Click the Save button to complete the static resource definition.

If your static resource contains a single file, refer to it in your Visualforce page using the syntax {!$Resource.name}, where name is the name of the static resource to include.

The syntax is different for referring to a single file within a static resource that is a zip archive. Use {!URLFOR($Resource.name, 'path/tofile')}, where name is the name of the static resource, and path/tofile is the full path to the desired file.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.131.142.80