Web applications 如果已授予位置权限,则签入托管Web应用

Web applications 如果已授予位置权限,则签入托管Web应用,web-applications,location,windows-10-universal,Web Applications,Location,Windows 10 Universal,我有一个简单的Windows10 Web应用程序,由MS Appstudio=>托管的Web应用程序生成。 该应用程序仅使用Package.appxmanifest并加载移动优化网站 在Web应用程序中,我使用。 是否可以从中集成更改位置隐私设置功能 在Web应用程序中,我使用。是否可以从中集成更改位置隐私设置功能 对于您的场景,您可以在html页面中使用java scrip Api集成更改位置隐私设置功能。您可以引用以下代码来启动privacy location index.html <

我有一个简单的Windows10 Web应用程序,由MS Appstudio=>托管的Web应用程序生成。 该应用程序仅使用Package.appxmanifest并加载移动优化网站

在Web应用程序中,我使用。 是否可以从中集成更改位置隐私设置功能

在Web应用程序中,我使用。是否可以从中集成更改位置隐私设置功能

对于您的场景,您可以在html页面中使用java scrip Api集成更改位置隐私设置功能。您可以引用以下代码来启动privacy location

index.html

<!--Set Visibility to Visible when access to location is denied -->  
<TextBlock x:Name="LocationDisabledMessage" FontStyle="Italic"
                 Visibility="Collapsed" Margin="0,15,0,0" TextWrapping="Wrap" >
          <Run Text="This app is not able to access Location. Go to " />
              <Hyperlink NavigateUri="ms-settings:privacy-location">
                  <Run Text="Settings" />
              </Hyperlink>
          <Run Text=" to check the location privacy settings."/>
</TextBlock>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>LunchUriTest</title>
    <link href="css/default.css" rel="stylesheet" />
</head>
<body>
    <div>Content goes here!</div>
    <button id="btnClick">Clik Me</button>

    <script src="js/main.js"></script>
</body>
</html>
(function () {
    document.querySelector("#btnClick").onclick = function () {
        if (typeof (Windows) != "undefined") {
            var uri = Windows.Foundation.Uri("ms-settings:privacy-location")
            Windows.System.Launcher.launchUriAsync(uri);
        } else {
            alert("Current environment is not uwp ")
        }
    }
})();