0

The Visualforce page is working fine in prod, but I spun up a Sandbox to do some dev work on it and the CSS wasn't loading, nor was jQuery. jQuery seems to be the first area where things start to break.

When I checked the network tab and compared what was loading between Sandbox and Prod, everything was the same up until it came time to load "jquery-1.11.0.min.js"... Prod was loading it, but the Sandbox wasn't. The snippet <script src="https://code.jquery.com/jquery-1.11.0.min.js"></script> is what is called to load the script, and it is only called in one spot based on a "Find in Folder" search in the codebase. There seem to be no references around it that are broken when comparing Sandbox and Prod. All Static Resources are exactly the same. There seems to be no difference in anything, besides the actual behavior. I've tried substituting jQuery.noConflict() in all places in all places this code touches, nothing.

Does anyone have a hunch about what may be happening?

1
  • Do you see any error in your browser console? Apr 14, 2021 at 17:25

2 Answers 2

1

It turned out to be that the page depended on some HTML files in Prod which were saved in Salesforce Classic under Documents. Documents don't get copied over, and so those dependencies were broken. Those HTML files were loading jQuery as well as some other things needed.

I went into Prod, downloaded them, and had to go into Salesforce Classic to upload them. I had to ensure that Document Searchable and Externally Available Image were selected before those files showed up in the Branding page of the Workspace.

0

It's possible that you need to set up permissions for your component to load the external jQuery library. Try going to Setup > CSP Trusted Sites and make sure you have an entry for https://code.jquery.com/.

If there is no entry, click on New Trusted Site and add https://code.jquery.com/. Make sure you check the checkbox for Allow site for connect-src.

If you have CSP set up correctly, I suggest checking the browser console for any error messages and posting them here. You can also go to the network tab and inspect the GET request to https://code.jquery.com/jquery-1.11.0.min.js and see if there are any errors there.

1
  • Unfortunately that did not work. The only error messages I'm getting are ones like: Uncaught ReferenceError: jQuery is not defined at bootstrap-tour.min.js:19 and other jQuery not defined errors. The interesting thing is, there isn't even a GET request to look at. For some reason the code in Prod makes that GET request, but the same code in Sandbox does not. Another interesting thing, I wanted to go into Experience Builder to check out the page there, but there is no way for me to launch into it, despite having System Admin permissions, and all permissions that the docs say to have. Apr 14, 2021 at 19:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .