Javascript: detecting when a link has been clicked - TechRepublic
General discussion
August 26, 2003 at 04:12 AM
mat_guthrie

Javascript: detecting when a link has been clicked

by mat_guthrie . Updated 22 years, 10 months ago

How can I detect when a link has been clicked but the new page is still in the process of loading? The document.location.href property still understandably displays the current location not the one that’s about to load.

I have a page that reloads every 30 seconds in order to access live data. If a user clicks on a link just prior to the page reloading the reload takes precedence over the link click and this is annoying for the users. When the page is about to reload I want to check to see if a link has just been clicked (and therefore a new page is about to load) and, if so, cancel the reload

Any suggestions as to how I can detect this (without having to put and onclick in every link) would be appreciated

This discussion is locked

All Comments