I'm trying to implement an exit pop up message when a visitor leaves the site. I'm using the "onunload" event handler. In FF, it works fine. The message appears. But in IE, the pop up only appears when I do a hard (shift+refresh) refresh.
I am trying to use the onunload event to know when the user closes a popup by receiving a request on the web server.
I have a main page from where the user opens a popup. What I want is when the user closes the popup, it sends a request to my web server (GoAhead) using the onunload event, then closes the popup.
For the moment, this what i have: when the user closes the popup, I use the onunload event to open a different popup (by this way, I get a request on the web server and I know that the user closes the first popup), then, this new popup closes itself with the onload event. It is working but having this second popup opening and closing is not very neat.
If I try to change the location of the first popup in the onunload event: onunload="document.location='....'", it doesn't send a request to the web server when the user closes the popup.
Is there a way to send a request to the webserver when the user closes the popup without the need to have an extra popup opened and closed ?
The web server I am using is working on a pseudo "cgi" mode called "goforms", it avoids to create a different process for each request. With "goforms", each request is handled by a unique process which is always running.
I have an onunload event in the body tag. When it is activated I want to know if a <a></a> href was clicked and which one. Is there some document property or any other object available for such a thing?
Is there anyway to display a confirm msg onUnload of a page?
I mean to say if iam calling onUnload=javascript:check();
and in check(){
if(confirm("check?")) { unload the page; } else { Dont unload , just come back to the previous state( i have some values in text fields to be retained) } }
I'm using IE6 and I've just created a simple page with this event: <body onunload="alert('sad')">
could someone tell me if this works for you if you have IE 6? I've tested this in firefox and IE 7 and they both work fine with it. but on the IE6 copy I'm testing, the event is fired only when the page is refreshed. It's not fired when I close the page...
I was trying to combine PHP & JavaScript to acheive on task:
I was trying to use javascript function to perform an PHP code, but the onUnLoad function seems to perform that query when the visitors reloads the page?
I want the PHP code to execute when the user EXITS the page.
javacript code....
<body onunLoad="doExit();">
Can anyone give me a function name or how can I make that work with onUnLoad?
I'm working on an asp.net site and am trying to implement a popup help window. I want the window to close when the user advances to the next page in our application. The thing is, I'm doing this on a component basis and I don't have access to the body tag from within my help component, so I can't add the onunload tag. Is there some other way of achieving what I want? Can I add an eventhandler to the body tag through javascript?
does anyone have sample code to display a pop up when a user leaves the site? I really don't want to use this technique, but the clients demand it.
I'm thinking something like un body onunload, catch the URL they're linking to and parse it for our own site's url and only display the pop up if they're different.
Is there a way to detect if the reason an onUnload() handler was called originated from the user explicitly refreshed the page(s)?
Ie. pressed "Ctrl-R", "F5" or klicked the refresh button in the toolbar or the context menu?
I'm aware that I can not stop a refresh, but the reason I want to know is that I have a hidden frame in an intranet application. This hidden frame is present at all times after the user have sucessfully logged in (to our db).
So the only time this frame is closed is when the user navigates away from the intranet app. At which point I want to log him/her out.
I do thid With an AJAX call in the unload-event of the hidden frame.
*BUT*... This leads to logging out if the user presses "F5", or in other ways refresh the window, since a refresh reloads both frames.
So I thought that if I could detect that this was a refresh in progress, I can avoid logging him/her out.
To make my system's admin page safer maybe I should apply <body onunload=""> somehow so that admin session would be reseted immediately after user closes the window?
But how to check easily that unloading refers only to windowclosing, not to following links to other admin subpages?
I have set up a disclaimer page for our public access PCs at our Libraries which has the following function:
function breach() { alert("Proceeding beyond these Conditions is..................... If you have read the Conditions, scroll to the bottom and press the 'Yes I
agree' button.") window.location="disclaim.htm"
and then in the body tag I have onunload=breach() This works fine for all websites entered into the address bar except if
you enter www.google.com
What it is supposed to do is bring up the prompt and when you click on the OK button it will go back to the disclaimer page. They should only be able to get to the web by clicking on the 'Yes I agree' button at the bottom of the disclaimer page. Does anyone out there know why google doesn't fire up the disclaim.htm page like all the other sites? It is very frustrating.
This error occurs ONLY in Netscape 7.0. Not in 7.1. So, I think it's a bug. Buuuut...
Has anyone had this problem or know of a fix?
When attempting to have an onunload function set with "window.onload=", the error comes up "permission denied to set property window.onunload"
I can't find a thing on this one. Setting it with the normal "<body onunload" works fine. But isn't a great thing for me to do, since the onload is part of a very large menu script.
Here's a test page to illustrate the problem. Netscape 7.0 has a problem with this. 7.1 does not. IE is fine, too. Code:
In windows7 RTM IE8 facing problem in onunload event. In onunload event I am trying to reset the cookies,also I am trying to end the session at the server side.For this I am submitting a form on onunload.Its working in all the other browsers. But in windows7 RTM IE8 I am getting ACCESS DENIED java script error.Someone have encountered the same problem
I have some problem with onunload where I want slideUp my menu when I go out form site. I have the slideDown function fire at body onload and this function work properly. but the slideUp() at onunload not.
My code: $(window).unload(function() { $('#menuContent1').slideUp(); alert('Handler for .unload() called.'); });
and even the alert work. Only the jQuery slideUp not working.
I am trying to initiate fancybox popup on page unload (i.e. when the user closes the browser window). I managed to find the following script which does the opposite (launches when the page loads). How can I reverse this code so that it executes on body unload?
How do I pass incremented variables from the parent to the child if I use onUnload="window.open()" ? I tried window.opener.document.getElementById('targetname') but it doesn't work because the parent is already closed when the child tries to get the information.