angular - 在 Http 主机不工作的情况下获取用户位置

标签 angular ssl iis https location

我想通过浏览器在 Angular 应用程序中获取使用位置

 if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition((position) => {
          model.latitude = position.coords.latitude;
          model.longitude = position.coords.longitude;

      } else {
        this.message = "Browser Not Support";
      }

并且用户位置可以正确 但是当在 IIS 上发布我的网站时出现错误

[Deprecation] getCurrentPosition() and watchPosition() no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See

在 Google 上搜索后,我发现大多数网站托管在 HTTPS 上

所以我有一些问题

1 - 有没有其他方法可以在不使用 HTML5 命令的情况下获取位置?

2 - 我的网站在本地 IIS 上托管,IP 为 192.168.10.5:1111,我的局域网上的用户访问网站,网络外的另一个用户首先连接到 VPN,然后连接到网站

现在我想使用 HTML5 命令获取我的大部分网站托管在 HTTPS 上的位置

我尝试了所有可能的方法

我尝试了 Google 上的所有教程

我测试了所有 Google 搜索“SSL LocalHost IIS”和“自签名 ssl 证书”
但是当打开 Url https://192.168.10.5:443 我的网站不安全 Chrome 错误

最后我想知道哪个可以从 Vpn 连接到本地 Https 网站?

并且可以在 LocalHost 上创建免费的 SSL 而不需要购买 SSL?

如果时间变长,我深表歉意

最佳答案

要解决您的问题,您可以从 letsencrypt(只需用谷歌搜索)获得免费的 SSL/TLS 证书,然后将其应用到您的 IIS 服务器。但可能 StackOverflow 不是提出这个问题的最佳场所。最好在serverfault里面问站点,因为它是服务器而不是编码问题。

关于angular - 在 Http 主机不工作的情况下获取用户位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57644010/

相关文章:

javascript - Angular 清晰设计不会延迟加载标签

c++ - boost::asio::ssl::context 可以在多个 SSL 流之间共享吗?

ssl - OpenLDAP - TDS - 无法联系 LDAP 服务器 (-1)

ssl - curl 中 --cacert 和 --capath 的区别?

c# - LogParser 访问被拒绝错误

angular - 为什么 ASP.NET Core 不接受以纯文本形式发送 PUT 请求?

Angular 2 RC 6 Material 2 Alpha 8 不工作

angular - 从选项卡转到根页面

asp.net - 配置asp.net web.config session

ruby-on-rails - 使用 IIS SEO 工具包时出现 System.Net.HttpWebException