Javascript: Access address bar and redirect to new URL? -


i've been given old javascript program keeps state information stored in url, past "#" state information not passed http server.

http://example.com/oldprogram/#/some-parms 

i need rewrite program, parameters handled on server. additionally, redirect old urls (saved in email, example) new service.

my question:

how can open url of old form, , have javascript rewrite url , redirect newly rewritten url? discussion purposes, translating "#" "@" perfect.

i.e., clicking on link:

http://example.com/oldprogram/#/some-parms 

causes page loaded:

http://example.com/newprogram/@/some-parms 

you can use:

window.location = ("" + window.location).replace("#", "@"); 

this redirect resulting url you've requested. have put script old page.

if not option there's no way can force redirect js. there other options url rewriting , redirecting through webserver's configuration.

for apache, example, use mod_rewrite.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

node.js - Using Node without global install -

php - CakePHP HttpSockets send array of paramms -