Redirect url javascript - Changes reverted