locked
unload event RRS feed

  • Question

  • Hi,

    On uload event of page, I want to compare current url and url which user has clicked. how can i do this?

    Thanks

    -Pradeep

    Tuesday, December 5, 2006 3:54 PM

Answers

  • try this:

    <script language="javascript">
    var linkClicked;
    window.onunload = Unload;

    function LinkClicked(url)
    {
      linkClicked = url;
      window.location = url;
    }

    function Unload()
    {
      var current = window.location.href;
      alert("Current: " + current + "\r\nGoing To: " + linkClicked);

    }
    </script>

    <body>
    <a href="#" onClick="LinkClicked('www.gosomewhereelse.com'); return false">Go Somewhere Else</a>
    </body>

    Tuesday, December 5, 2006 7:47 PM
    Moderator