我有一个使用html5Mode = true的应用程序,但是在IE上,我不需要回到#/url。我需要的是保持URL和一个完整的页面重新加载。
如果我找不到任何方法,我将需要编辑AngularJS文件,这就是我不想要的。
有什么建议吗?
谢谢!
-编辑--
作为一个时态解决方案,我在AngularJS文件中注释了一些代码。
/*if ($sniffer.history) {*/
$location = new LocationUrl(
convertToHtml5Url(initUrl, basePath, hashPrefix),
pathPrefix, appBaseUrl);
/*} else {
$location = new LocationHashbangInHtml5Url(
convertToHashbangUrl(initUrl, basePath, hashPrefix),
hashPrefix, appBaseUrl, basePath.substr(pathPrefix.length + 1));
}*/现在,它不再返回到Hashtag urls,如果浏览器不支持历史API,则Browser.url将生成一个location.href。
发布于 2013-11-27 03:14:54
我觉得这能做你想做的事。如果不是,解决方案可能涉及相同的事件$locationChangeStart。
var gate = 1;
$scope.$on("$locationChangeStart", function(event, nextLocation, currentLocation) {
if ($('html').is('.ie6, .ie7, .ie8')) {
if (gate === 0) { //prevent endless location change
gate = 1;
window.location.href = nextLocation; //reload the page
}
else {
gate = 0;
}
}
});如果你不知道这个OldIE检查,see this post.
https://stackoverflow.com/questions/13666038
复制相似问题