Android redirect does not work

后端 未结 5 1281
故里飘歌
故里飘歌 2021-01-02 08:03

I need to redirect in a javascript file to a given URI specified by the user.

So a quick example how I do this:

function redirect(uri) {
  if(navigat         


        
5条回答
  •  孤街浪徒
    2021-01-02 08:51

    I would suggest :

    location.assign('someUrl');
    

    It's a better solution as it keeps history of the original document, so you can navigate to the previous webpage using back-button or history.back() as explained here.

提交回复
热议问题