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
Andrew KulikAndrew Kulik 

Geolocation has been disabled in this document by feature policy

We have an Angular app inside a VisualForce page and are trying to use "navigator.geolocation.getCurrentPosition". This is working ok in a scratch org but when I push the changes to a sandbox I get the error "Geolocation has been disabled in this document by feature policy".

I have a found the same question here https://salesforce.stackexchange.com/questions/207245/salesforce1-stopped-supporting-geolocation but there isn't an answer.
VinayVinay (Salesforce Developers) 
Hi Andrew,

Try below snippet.

<iframe id="ap3-iframe" src="https://example.com/your-geo-page/?appp=3" allow="geolocation"></iframe>

Review below link for more information.

https://docs.apppresser.com/article/418-iframe-geolocation-feature-policy

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar
Andrew KulikAndrew Kulik
Hi Vinay,

Thanks for the answer. I have had a look but I can't see that we are using an iframe anywhere or should I add an iframe to our visualforce page and put the API url as the src?
VinayVinay (Salesforce Developers) 
Hi Andrew,

Try to include iframe in VF page also check if Clickjack protection was enabled for visualforce page.

In Setup ---> Session Settings ---> Clickjack Protection
Uncheck - Enable clickjack protection for customer Visualforce pages with headers disabled .

Review below links which can give you more information.

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_iframe.htm
https://help.salesforce.com/articleView?id=000322792&type=1&mode=1
https://stackoverflow.com/questions/51717856/geolocation-has-been-disabled-in-this-document-by-feature-policy

Thanks,
Vinay Kumar
Andrew KulikAndrew Kulik
Thank Vinay, I have go this working in a scratch org using this apprach. There's still an issue in the sandbox but that could be our Orgs config so I am going to try and go down a LWC route