Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS How to remove # symbol in IE9 by using route

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

This always redirects to

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

and shows this description:

The requested resource is not available.

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

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

How can I rectify this?

like image 930
TheLast BlackCat Avatar asked Jul 24 '13 09:07

TheLast BlackCat


3 Answers

IE9 does not have html5 history api support, that's why it's appending # to the url, removing # will not solve your problem

like image 138
karaxuna Avatar answered Nov 08 '22 18:11

karaxuna


$location Documentation

See "Hashbang 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.

like image 33
Umur Kontacı Avatar answered Nov 08 '22 17:11

Umur Kontacı


In fact we can not remove that, but we can make it work smoothly

RouterModule.forRoot(ROUTES, { useHash: Boolean(history.pushState) === false });
like image 22
Kevin Black Avatar answered Nov 08 '22 19:11

Kevin Black