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

How to display a static resource in a public Sites Visualforce page?

When I tried {!$Resource.resources_name} in my Site's VF pages, I see the "/resource/..." URL, which does not work for the host address of my Site.  All I see, for example for images, are broken image icons.  If I take the relative URL supplied by the {!$Resource...} and put it on the hostname of my Salesforce instance when logged into Salesforce proper, it works fine. I know that all permissions are properly set for the Site guest user profile (unless I missed a specific one for static resources somewhere).  I did set the caching for each resource to public.   If I am logged into Salesforce proper and looking at my Site, that s the only way I can see the static resources. Of course, my future customers will not be able to see them.


Any suggestions?




For public pages, uses a global content delivery network of cache servers that hold copies of your static files. If a URL request comes in for a file that is already in the cache, it serves up the cached version instead of retrieving it from the platform. This leads to a faster response time. Keep in mind that for this to work properly, you should set the Cache Control setting on the resource to Public.


You have to set cache control to Public


For more clarity refer to the link below:-



Hope this helps..


Funny you should ask, I just went to edit the original post that I did infact set the cache to public... and still I can only see then on the Site if I am logged into Salesforce proper.  Thanks for the link, I've actually already reference that.  So... still not working.  Thanks though.



edit:  By the way, I can see images imbeded in rich text fields just fine.


Did you figure this out?

I need to do the same thing,



Eric FortenberryEric Fortenberry
I am having the same issue.  Did you figure it out?
Bernard CarpioBernard Carpio

I did what Ispita's advised and it works perfectly.