Prevent javascript execution when page is only preloaded by hovering a href link

Viewed 20

I have a page (call it page B) with some Javascript code, running Ajax calls to the backend.

My problem is the the javascript is executed when user is on page A, and hovers the link to page B (the browser seems to make a GET request, to preload the next page). Is there any way to make sure the javascript on page B is only executed on a "real" visit?

<script type="text/javascript">
$(document).ready(function() {
    // Run script
});
</script

0 Answers
Related