Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.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
AngularJS如何使用route删除IE9中的#符号_Angularjs_Internet Explorer 9_Routes_Using - Fatal编程技术网

AngularJS如何使用route删除IE9中的#符号

AngularJS如何使用route删除IE9中的#符号,angularjs,internet-explorer-9,routes,using,Angularjs,Internet Explorer 9,Routes,Using,我无法删除IE9中的#符号。我寻找答案,但没有找到解决办法 这总是重定向到 http://myhost.com:8080/#/website/ 并显示以下描述: The requested resource is not available. locationprovider.HTML5模式(true)不工作。 同样的路径在FireFox和shows中也起作用 http://myhost.com:8080/website/ 我如何纠正这个问题?IE9不支持html5历史api,这就是为什么

我无法删除IE9中的#符号。我寻找答案,但没有找到解决办法

这总是重定向到

http://myhost.com:8080/#/website/
并显示以下描述:

The requested resource is not available.
locationprovider.HTML5模式(true)
不工作。 同样的路径在FireFox和shows中也起作用

http://myhost.com:8080/website/

我如何纠正这个问题?

IE9不支持html5历史api,这就是为什么它在url中添加“删除”不会解决您的问题的原因

参见“Hashbang和HTML5模式”

基本上,html5模式在浏览器支持时使用
历史API
,在不支持时使用hashbang(
#


在没有历史API的浏览器中,不能“仅”删除“#”。因为当您更改url时,浏览器将尝试强制重新加载,从而中断流。

使用
window.location.hash='/'
解决了我的问题

if(window.history&&window.history.pushState){
$locationProvider.html5Mode(true);
}
否则{
window.location.hash='/'//IE 9修复
$locationProvider.html5Mode(true);

}
事实上,我们无法消除这一点,但我们可以让它顺利运行

RouterModule.forRoot(ROUTES, { useHash: Boolean(history.pushState) === false });

谢谢你的回答。我如何解决这个问题?在不起作用时将/#/插入/path/in…:(@LastBlackcat我只会在你的位置上使用。关闭html5模式:)你好,你解决了这个问题吗?我遇到了完全相同的问题。@Last Blackcat也在寻找解决方案。事实上,angular可以在浏览器不支持hte History API的情况下以正确的方式处理它,“如果浏览器不支持HTML5 History API,$location服务将自动退回使用hashbang URL。”