IE 9 not supporting $locationProvider.html5Mode

前端 未结 2 662
挽巷
挽巷 2020-12-18 05:08

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

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-18 05:37

    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);
    }
    

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

提交回复
热议问题