我有一个 angularjs (v 1.2.19) 应用程序,它由两个单独的 html 页面组成(或者实际上这些是一个文件夹中的两个单独的 angularjs 应用程序):
- 索引.html
- 编辑.html
我在 IE 8 和 9 上遇到了一些众所周知的兼容性问题(两者都不支持 html5 历史 API)。我的配置包含:$locationProvider.html5Mode(true).hashPrefix('!');
我在应用程序中没有任何路由 - index.html 和 edit.html 可以被视为单独的 angularjs 应用程序 - 具有单独的 angularjs 初始化等。
问题看起来像这样:每当我打开链接:http://server/app
或者http://server/app/index.html
一切正常。
每当我打开链接时:http://server/app/edit.html
从 ng-click 或直接在浏览器中,页面会自动重定向到http://server/#!app/edit.html
如何禁用“hashbang”重定向?Edit.html 不是 index.html 的一部分,因此应该直接加载它,而不需要任何 index.html 重定向和“哈希”路由。
我尝试了下面的代码,但它导致了无限循环的重定向......
<!--[if lt IE 10]>
<script>
window.location = window.location.href.replace( /#.*/, "");
</script>
<![endif]-->
任何帮助表示赞赏。