Questions tagged [window.onunload]

The window object in JavaScript has an event handler called onload . When this event handler is used, the entire page and all of its related files and components are loaded before the function listed in the onload event handler is executed, hence the term "on load."

77 questions
1
vote
0 answers

using google analytics tracker function with window.onload

I am running another script on my website called "mylivechat" and wanting to track one of the divs in the mylivechat popunder. However, the mylivechat script seems to take too long load and doesnt get tracked by the google analytics. Here's the…
Ke.
  • 2,484
  • 8
  • 40
  • 78
1
vote
2 answers

how to remove data from localStorage when browser is closed not when tab is closed?

I used window.onunload and tried window.onbeforeunload but both are clearing the data on tab close as well. I want the data to remain when tab is closed and it should clear it out when the entire browser is closed. Any solution on this?
Rahul Gupta
  • 972
  • 11
  • 29
1
vote
0 answers

Javascript onUnload Show offer and redirect to offer page if stays on page

I have a page-a where I offer something for $10 , when the user tries to leave the page, I would like to ask them if they want same thing for $5. So using onunload I could show a confirmation box with my message using this code. function goodbye(e)…
Dipendra Pokharel
  • 508
  • 1
  • 5
  • 15
1
vote
2 answers

ASP.net user control nightmare

I have implemented a user control that I reuse on several pages. However, I have run into variety of issues such as session maintenance across pages, session clearing on navigating away - essentially control state maintenance, that I am wondering…
sarsnake
  • 26,667
  • 58
  • 180
  • 286
1
vote
2 answers

Dropzone prevent page unload

I'm using dropzone to upload files but I want to prevent the page unload during upload. How can I do to sync dropzone with a window.onbeforeunload?
Tobia
  • 9,165
  • 28
  • 114
  • 219
1
vote
1 answer

Jquery Exit Popup Confusion

I have the following code on closing the full…
Aishwarya
  • 1
  • 1
0
votes
1 answer

How to handle window unload event with browser back support in angular?

I have an web application which by default saves the user's data at server side if the user's connection get closed by any way which was not initiated by user (Like user's browser process get killed, user's system turned off or if user's internet…
Aayush Jain
  • 183
  • 1
  • 11
0
votes
0 answers

Update $(window).on('load', function () for jQuery v3+ | Firefox Issue

Wondering how this jQuery script could/should be updated to be compliant with jQuery v.3+? This script adds & removes a class from our main content wrapper, with which we use CSS opacity & transition to create elegant fade-out and fade-in on page…
Kenny J
  • 11
  • 1
  • 10