I have two ways of viewing a VF page.
Through my org with a url like this: https://cseo-dev-ed--seo.na35.visual.force.com/apex/SurveyWelcome?id=a004100000D0mqkAAB
Through a public force.com site that anyone can view through this url: https://surveytest01-developer-edition.na35.force.com/SEO__SurveyWelcome?id=a004100000D0mqk&cntid=0034100000ds6Ia&souceid=0034100000ds6Ia&soucetype=contact
The problem I'm having is my controller is only returning a value when it's accessing the 1st url. When I go to my public force.com site, the apex controller variable doesn't return anything.
Here is the javascript I run when the page loads
<script>
const images = "{!URLFOR($Resource.img, 'uploads/')}";
var h = document.getElementsByTagName("html")[0];
var b = document.getElementsByTagName("body")[0];
h.style.backgroundImage = `url(${images}{!NewSurvey.SEO__Background_Image__c})`;
b.style.backgroundImage = `url(${images}{!NewSurvey.SEO__Background_Image__c})`;
console.log(`{!NewSurvey.SEO__Background_Image__c}`);
</script>
I'm sure it has something to do with security, but I'm not sure what part of it. My controller for the vf page is public.


Guest User profile. Have you granted access of the objects/fields your controller is trying to access to that profile?