【问题标题】:Is there a way to open Microsoft Map on Windows 10 from browser javascript有没有办法从浏览器 javascript 在 Windows 10 上打开 Microsoft Map
【发布时间】:2016-02-25 03:43:29
【问题描述】:

我正在开发一个包含地址的应用程序。用户可以点击或点击地址,在安卓设备上,运行以下网页代码,打开带有目标地址的谷歌导航并准备好轮流。

代码如下: window.open("google.navigation:q=lat,lon", '_system');

我正在尝试在其他设备上执行此操作,例如安装了 Here Windows 地图的 Windows 10 表面?

我在 Surface 上运行上面的代码,你会得到一个提示,说你需要在商店中找到一个应用程序才能打开 google.navigation,所以我认为它可能会完成。

有人知道这是否可能吗?接下来将尝试弄清楚如何在 Apple 平板电脑或手机上打开导航,如果有人对该平台有任何指示。

谢谢

【问题讨论】:

    标签: javascript navigation


    【解决方案1】:

    发布此消息后,我偶然发现了一个显示一些launch commands 的链接。

    下面的工作。系统会提示用户打开一个可以理解的应用程序,但它确实会打开 Windows 地图以进行导航并计算路线。

    仍在寻找在 idevices 上执行此操作的方法。

    function GetMobileOperatingSystem() {
    var userAgent = navigator.userAgent || navigator.vendor || window.opera;
    
    
    if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i) || userAgent.match(/iPod/i)) {
    
        return 'iOS';
    
    }
    else if (userAgent.match(/Android/i)) {
    
        return 'Android';
    }
    else if(userAgent.match(/Windows Phone/i))
    {
        return 'Windows Phone';
    }
    else if (userAgent.match(/Windows NT/i) && userAgent.match(/Tablet PC/i)) {
        return 'Windows Tablet';
    }
    else if (userAgent.match(/Windows NT/i)) {
        return 'Windows Desktop';
    }
    else {
        return 'unknown';
    }
    }
    
    function OpenNavigation(lat, lon) {
        // If Android device, open coordinates for google navigation
        if (GetMobileOperatingSystem() === 'Android') {
            // window.open("google.navigation:q=35.208707,-80.830739", '_system');
            window.open("google.navigation:q=lat,lon", '_system');
        }
        else if(GetMobileOperatingSystem().match(/Windows/i))
        {
            // window.open("http://maps.google.com/maps?daddr=" + lat + "," + lon);
            window.open("ms-drive-to:?destination.latitude=" + lat + "&destination.longitude=" + lon);
        }
    
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多