How to execute some jQuery or JavaScript code after a redirect has completed

后端 未结 4 1622
心在旅途
心在旅途 2021-01-20 00:21

How can I execute jQuery/JS code as soon as a jQuery/JS redirect like...

$(location).attr(\'href\',\'/target_path\');

...or...



        
4条回答
  •  被撕碎了的回忆
    2021-01-20 01:18

    You can't do that in the page that's redirecting. You can read the referrer in the landing page (document.referrer), and then decide whether to display an alert based on that, though.

提交回复
热议问题