首页 > 解决方案 > URL 重定向和重新加载在 Safari 和 IE 中不起作用

问题描述

我正在使用以下方法重定向到Item页面并重新加载整个页面。适用于所有浏览器,但 Safari 和 IE(一如既往!)。在这两个中,当前页面被重新加载。

有关如何以不同方式进行操作的任何建议?

<a href="/items/{{item.$id}}" onclick="location.reload()" class="btn">Item</a>

我在JS中也试过如下,但在Safari和IE中也出现同样的问题

$scope.redirect = function(Item) {
     window.location.href = '/items/' + item.$id;
     window.location.reload(); 
}

标签: javascripthtmlangularjsredirectcross-browser

解决方案


尝试这个:

$(document).ready(function(){
 // put all your js inside it
 init();
});

也尝试通过禁用缓存参数


推荐阅读