AngularJS 如何使用路由删除 IE9 中的 # 符号 [英] AngularJS How to remove # symbol in IE9 by using route

查看:21
本文介绍了AngularJS 如何使用路由删除 IE9 中的 # 符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法删除 IE9 中的 # 符号.我搜索了答案,但没有找到解决方法.

I can't remove the # symbol in IE9. I searched for an answer but didn't find a fix.

这总是重定向到

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

并显示此描述:

The requested resource is not available.

locationprovider.html5mode(true) 不起作用.相同的路线在 FireFox 中工作并显示

locationprovider.html5mode(true) is not working. The same route is working in FireFox and shows

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

我该如何纠正?

推荐答案

$location 文档

参见Hashbang 和 HTML5 模式"

See "Hashbang and HTML5 modes"

基本上,html5模式在浏览器支持时使用History API,不支持时回退到hashbang(#).

Basically, html5 mode uses History API when the browser supports it, and falls back to hashbang(#) when it is not supported.

您不能在没有 History API 的浏览器中仅仅"删除#".因为当您更改 url 时,浏览器会尝试强制重新加载,从而中断流程.

You cannot "just" remove "#" in a browser without History API. Because when you change the url, the browser would then try to force a reload, breaking the flow.

这篇关于AngularJS 如何使用路由删除 IE9 中的 # 符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆