Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 边到边导航问题_Angular_Navigation_Microsoft Edge - Fatal编程技术网

Angular 边到边导航问题

Angular 边到边导航问题,angular,navigation,microsoft-edge,Angular,Navigation,Microsoft Edge,我有一个应用程序,需要在edge中打开一些应用程序。例如,有一个按钮onclick on按钮将有一个应用程序链接,这样它将只在边缘打开。为此,我使用了以下代码RedirectToCostAnalytics(){ window.location.href='microsoft edge:https://google.com/'; } 当我在chrome&IE中运行应用程序时,它正在工作,但当我在edge中运行应用程序并单击按钮时,它会给我“错误:导航”消息。这是常见问题还是我犯了错误 您使用的是

我有一个应用程序,需要在edge中打开一些应用程序。例如,有一个按钮onclick on按钮将有一个应用程序链接,这样它将只在边缘打开。为此,我使用了以下代码
RedirectToCostAnalytics(){
window.location.href='microsoft edge:https://google.com/';
}

当我在chrome&IE中运行应用程序时,它正在工作,但当我在edge中运行应用程序并单击按钮时,它会给我“错误:导航”消息。这是常见问题还是我犯了错误

您使用的是什么版本的Edge?我在Edge Legacy和Edge Chromium上进行了测试,url方案无法在任何一种边缘浏览器上打开,但我没有看到任何错误

作为一种解决方法,您可以在打开链接之前检查浏览器版本:

window.navigator.userAgent.indexOf("Edge") > -1  //check for Edge Legacy
工作代码示例:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <input type="button" value="test" onclick="RedirectToCostAnalytics()"/>
    <script>
        function RedirectToCostAnalytics() {
            if ((window.navigator.userAgent.indexOf("Edge") > -1) || (window.navigator.userAgent.indexOf("Edg") > -1)) {
                window.location.href = 'https://google.com/';
            }
            else {
                window.location.href = 'microsoft-edge:https://google.com/';
            }
        }
    </script>
</body>
</html>

函数重定向到OSTAnalytics(){
if((window.navigator.userAgent.indexOf(“Edge”)>-1)| |(window.navigator.userAgent.indexOf(“Edg”)>-1)){
window.location.href=https://google.com/';
}
否则{
window.location.href='microsoft edge:https://google.com/';
}
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <input type="button" value="test" onclick="RedirectToCostAnalytics()"/>
    <script>
        function RedirectToCostAnalytics() {
            if ((window.navigator.userAgent.indexOf("Edge") > -1) || (window.navigator.userAgent.indexOf("Edg") > -1)) {
                window.location.href = 'https://google.com/';
            }
            else {
                window.location.href = 'microsoft-edge:https://google.com/';
            }
        }
    </script>
</body>
</html>