Javascript window.open()的重定向在IE中不起作用
我有以下代码在Chrome中运行得非常好:单击Javascript window.open()的重定向在IE中不起作用,javascript,internet-explorer,cross-browser,window.open,Javascript,Internet Explorer,Cross Browser,Window.open,我有以下代码在Chrome中运行得非常好:单击New,它会打开一个弹出窗口,然后单击Change将重定向到另一个页面 新的 改变 var app=angular.module('plunker',[]); app.controller('contentCtrl',['$scope',函数($scope){ $scope.openNew=函数(){ $scope.popup=window.open(“https://www.stackoverflow.com“,”弹出窗口“,”状态=1,位置=
New
,它会打开一个弹出窗口,然后单击Change
将重定向到另一个页面
新的
改变
var app=angular.module('plunker',[]);
app.controller('contentCtrl',['$scope',函数($scope){
$scope.openNew=函数(){
$scope.popup=window.open(“https://www.stackoverflow.com“,”弹出窗口“,”状态=1,位置=1“;
}
$scope.change=函数(){
//$scope.popup=window.open(“https://www.sina.com“,”弹出窗口“,”状态=1,位置=1“;
//$scope.popup.location.assign(“https://www.sina.com")
//$scope.popup.location.href(“https://www.sina.com")
//$scope.popup.location=”https://www.sina.com"
$scope.popup.location.href=”https://www.sina.com"
}
}]);
但是,该代码在IE11中不起作用。我找到了IE中列出的几种重定向方法,我尝试了location.assign(…)
,location.href(…)
,等等。它们都不起作用
有人知道如何在IE中实现window.open的重定向吗?根据,window.location.href=
似乎是在IE中设置(和获取)窗口URL的最佳方法
如果这不起作用,replace应该执行以下操作:
$scope.popup.location.replace('https://www.google.com/");代码>很高兴听到;)
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
</head>
<body ng-controller="contentCtrl">
<button ng-click="openNew()">New</button>
<button ng-click="change()">Change</button>
<script>
var app = angular.module('plunker', []);
app.controller('contentCtrl', ['$scope', function ($scope) {
$scope.openNew = function () {
$scope.popup = window.open("https://www.stackoverflow.com", "popup", "status=1, location=1");
}
$scope.change = function () {
// $scope.popup = window.open("https://www.sina.com", "popup", "status=1, location=1");
// $scope.popup.location.assign("https://www.sina.com")
// $scope.popup.location.href("https://www.sina.com")
// $scope.popup.location = "https://www.sina.com"
$scope.popup.location.href = "https://www.sina.com"
}
}]);
</script>
</body>
</html>