Safari Localhost Permission Blocked

前端 未结 2 572
旧时难觅i
旧时难觅i 2021-01-03 18:32

So ran into this issue today, where I have a website that needs the geolocation of the user. It was working fine when running locally on localhost, but now I get an error sa

相关标签:
2条回答
  • 2021-01-03 19:12

    Maybe it's possible to use https ( How to get angular-cli to ng serve over HTTPS ) and if not is possible directly for some reason maybe you can use a transparent proxy that offers https.

    Many HTML5 new features like access to webcam, geolocation and others are now allowed only on pages served thru https scheme, so probably using https will work again. If not, maybe is possible to modify hosts file to workaround the problem.

    0 讨论(0)
  • 2021-01-03 19:17

    I found a sort of solution but it is a bit tedious. I use ngrok to route my server and then the geolocation works fine. The only thing I don't like is that it has limits (if you are using free account), like you can't refresh a lot of times.

    edit:

    To Use ngrok download it first, then on terminal type

    ./ngrok http <port number>
    

    ngrok example. It will then show you the url routes. I used https. Go to to that address.

    More ngrok instructions and download

    0 讨论(0)
提交回复
热议问题