microsoft / PowerBI-visuals-tools

Contains tools for building/packaging Power BI visuals
https://www.powerbi.com
MIT License
330 stars 148 forks source link

geolocation error - disabled by default (feature request) #493

Closed HERVEBONNEL closed 8 months ago

HERVEBONNEL commented 10 months ago

I am trying to make an active map visual based on current position however a simple code in the constructor of a visual.ts requesting a geolocation results in error.

eg navigator.geolocation.getCurrentPosition(console.log)

the log results in : "Geolocation error: Geolocation has been disabled in this document by permissions policy.." There seems no way to set the policy in capabilities.json or otherwise.

If the same code is run from the console, the script generates the location coords object.

Same issues with other CSP policies such as img-src to load external tiles. More granular set up of CSP policies and other policies such as geolocation could be useful.

Please help with any workaround or feature addition.

AleksSavelev commented 9 months ago

Hello @HERVEBONNEL, What version of powerbi-visuals-api do you use?

HERVEBONNEL commented 9 months ago

powerbi-visuals-tools version - 5.2.1

HERVEBONNEL commented 8 months ago

Hi @AleksSavelev, please let me know if there is workaround to this or possible to include feature. I tried API 5.3.0 and it s not working. I am wondering if the issue is with the encapsulation within the iframe which does not allow geolocalisation functions.

AleksSavelev commented 8 months ago

Hi @HERVEBONNEL, I'm sorry for the late response.

Try to add WebAccess to your privileges in capabilities.json

    "privileges": [
        {
            "name": "WebAccess",
            "parameters": [
                "*"
            ]
        }
    ]

But for your information: It's restricted for certified visuals

HERVEBONNEL commented 8 months ago

No success I am afraid. i am wondering if issue is