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
Ramu kolliRamu kolli 

Block third party urls in visualforce

Hi All,

I would like to block third party URLs such as Google APIs which are loading JS in my visualforce page. I need to allow them if they are whitelisted in CSP/CORS. Thanks in advance.
SwethaSwetha (Salesforce Developers) 
HI Ramu,
How are you importing your JS file? Is it via static resource?
Ramu kolliRamu kolli
Hi Swetha,
Thanks for your reply. I am calling Google api directly from visualforce page using includescript tag. 

Thanks
SwethaSwetha (Salesforce Developers) 
Can you trying to load scripts by storing them as Static Resources?
 
<apex:includeScript value="{!URLFOR($Resource.STATICRESOIRCENAME)}'/>
I have come across a similar post which might help:https://salesforce.stackexchange.com/questions/176331/no-access-control-allow-origin-locker-service-ltngrequire