IE 9 不支持 $locationProvider.html5Mode [英] IE 9 not supporting $locationProvider.html5Mode

查看:37
本文介绍了IE 9 不支持 $locationProvider.html5Mode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个 angularjs 应用程序.我将 $locationProvider.html5Mode 设为 true.现在我得到了没有 # 的漂亮网址.它在 chrome 和 firefox 中运行良好.但是当我尝试在 IE 9 中打开它时,它一直在重新加载.

Hi I am creating an angularjs app . I made $locationProvider.html5Mode as true. Now I am getting pretty url without # . It is working fine in chrome and firefox. But when I tried to open it in IE 9 , it is reloading continuously.

推荐答案

坏消息.IE9 不支持 HTML5 History API.这就是 angular html5Mode 使用的.如果你需要你的应用在 IE9 上运行,你需要切换回来或添加代码来检测历史 API 是否可用,使用或默认为哈希

Bad news. IE9 do not support HTML5 History API. That is what angular html5Mode uses. If you need your app to run on IE9 you need to switch back or add code to detect if History API is available the use is or default to the hash

function supports_history_api() {
  return !!(window.history && history.pushState);
}

我知道.愚蠢的IE.它应该死得很痛苦.

I know. Stupid IE. It should die a painful dead.

这篇关于IE 9 不支持 $locationProvider.html5Mode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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