Javascript event that runs before page changes

后端 未结 3 1682
感情败类
感情败类 2021-01-02 05:46

Is there such a thing?

I know that I can hook my function on the click event of all links, but there are other situations where a page is changed, like refresh or wh

3条回答
  •  半阙折子戏
    2021-01-02 06:04

    When a page is reloaded, whatever was there before will be gone. Thus, it seems like what you're talking about is something you'd do at DOMReady or "load" in the new page, since you can't "push" code from the former page into the new context.

提交回复
热议问题