Reputation: 4228
I'm working on an angular application that has been around for a while.
So far I've used the normal #
mode, without any prefix.
The application has quite some content so some of the customers might have bookmarked them (with the hash url schema).
Now I'd like to switch to html5Mode
but keep compatibility with the old url schema.
I mean, for example if I previously had this url www.mysite.com/#/action/content?param1=A¶m2=B
in html5mode it will be www.mysite.com/action/content?param1=A¶m2=B
.
What I want is: if any user knows the old url (with the #
) and he uses it in his browser I'd want my application to be smart and redirect the user to the correct page using the new html5Mode
url or keep on using the the old url if the browser doesn't support the new html5Mode.
Is this possible?
(I'm using ui-router
)
Upvotes: 1
Views: 144
Reputation: 1360
One possible way what i can think of is that when the page loads and when you are about to set the html5 mode in the angular check for the hash value in the url and if it is present then simply set it to false and vice versa
Upvotes: 1