Get url for the page being opened next in [removed] event

前端 未结 2 1929
遇见更好的自我
遇见更好的自我 2021-01-21 03:37

Is there a way get the location for page being opened next in the window.onunload event.

Best Regards, Keshav

2条回答
  •  醉梦人生
    2021-01-21 04:21

    The current page cannot and should not know where the user wants to go next (via address bar or bookmarks) (as @nalply said).

    If your situation is you want to know which link that the use clicked on your page, then you can do this with javascript. Have a temporary variable that is populated with the URL everytime the user clicks on a link on your page. Then in window.onunload, you can use this.

    If this is not your situation, can you tell your specific requirement on why you want to this? Perhaps you might get better solutions if you tell what you are trying to acheive.

提交回复
热议问题