How can i get the destination url of a link on the web page in the javascript onbeforeunload event?

前端 未结 2 562
清酒与你
清酒与你 2021-01-29 07:55

Is it possible to capture what link on the web page the user clicked on? Not talking about if they manually entered an url in the address bar or if they clicked on the back butt

2条回答
  •  梦毁少年i
    2021-01-29 08:32

    Instead of having a completely different set of headers/footers you could replace all links in certain areas with links that open in a new window like so:

    $('#header a, #footer a').each(function() {
      $(this).attr('target', '_blank');
    });
    

提交回复
热议问题