IE 9 not supporting $locationProvider.html5Mode
Asked Answered
T

2

6

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.

Tabard answered 31/3, 2014 at 14:0 Comment(2)
possible duplicate of AngularJS How to remove # symbol in IE9 by using routeEnrico
Have a look at this #17830491Enrico
N
11

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.

Nailhead answered 31/3, 2014 at 20:3 Comment(3)
hi now it is working for IE9 by putting this condition. But this condition returning true in android browsers and existing the old problem.Tabard
What version on android?Nailhead
my version is android 2.3Tabard
R
3

$location Documentation

See "Hashband and HTML5 modes"

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

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.

Rockwell answered 19/5, 2015 at 14:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.