Highlighted

jQuery to not to fire an event if a page reload or refresh happens

Rookie Contributor
Hi, could someone help me with the jQuery code for to set not to fire a particular event while page refresh / reload happens?
3 REPLIES 3
Highlighted

jQuery to not to fire an event if a page reload or refresh happens

Employee Emeritus
Hari I am having a hard time understanding the question. Are you saying you would like the event to fire when the user first lands on the page. However if they press the refresh button, you do not want the event to fire again? Or perhaps you are trying to delay the execution of jQuery code until after the page has fully loaded? Also can you be more clear when you use the word event. Does this mean Site Catalyst event, javaScript event, a Tealium event? Thank you in advance for the clarification. Brian
Highlighted

jQuery to not to fire an event if a page reload or refresh happens

Rookie Contributor
Hi Brian, Thanks for looking in to this. Yes, we would like the event to fire when the user first lands on the page. but do not want the event to fire again if they reload the page by pressing refresh button. It's a SiteCatalyst event. Hari
Highlighted

jQuery to not to fire an event if a page reload or refresh happens

Employee Emeritus
I don't think you can know for sure if the user hit the refresh button. However you could put the location.href in a cookie and then on page view check to see if current location.href is equal to the one in the cookie. If it is, you could use this information to set event data for SiteCatalyst.