Newer Version Available

This content describes an older version of this product. View Latest

Creating a Static Resource

To create a static resource:
  1. From Setup, enter Static Resources in the Quick Find box, then select Static Resources.
  2. Click New.
  3. In the Name text box, enter the text that should be used to identify the resource in Visualforce markup. This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.

    If you reference a static resource in Visualforce markup and then change the name of the resource, the Visualforce markup is updated to reflect that change.

    Note

  4. In the Description text area, specify an optional description of the resource.
  5. Next to the File text box, click Browse to navigate to a local copy of the resource that you want to upload.

    A single static resource can be up to 5 MB in size, and an organization can have up to 250 MB of static resources, total.

  6. Set the Cache Control for user sessions, including API and Experience Cloud user sessions:
    • Private specifies that the static resource data cached on the Salesforce server shouldn’t be shared with other users. The static resource is stored in cache only for the current user’s session.

      Cache settings on static resources are set to private when accessed via a Salesforce Site whose guest user's profile has restrictions based on IP range or login hours. Sites with guest user profile restrictions cache static resources only within the browser. Also, if a previously unrestricted site becomes restricted, it can take up to 45 days for the static resources to expire from the Salesforce cache and any intermediate caches.

      Note

    • Public specifies that the static resource data cached on the Salesforce server be shared with other users in your organization for faster load times. For API users, the resource is accessible to all internet traffic.
    The W3C specifications on Header Field Definitions has more technical information about cache-control.

    This feature only works for Sites—enabled organizations that use the static resource.

    Note

  7. Click Save.

If you are using WinZip be sure to install the most recent version. Older versions of WinZip may cause a loss of data.

Warning