Detecting If OnUnload() Was Called Because Of A Refresh...
Sep 2, 2005
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.
View 3 Replies
ADVERTISEMENT
Aug 10, 2007
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.
Any ideas why IE is acting differently?
View 2 Replies
View Related
Jul 23, 2005
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.
View 3 Replies
View Related
Jul 23, 2005
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?
View 5 Replies
View Related
Jul 23, 2005
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 want to call this function on Unload.
View 3 Replies
View Related
Jun 7, 2006
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...
View 1 Replies
View Related
May 13, 2003
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?
View 2 Replies
View Related
Jul 20, 2005
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?
View 2 Replies
View Related
Jul 20, 2005
I would like to ignore onUnload action when the user reloads the page!!
View 6 Replies
View Related
Jul 23, 2005
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.
View 10 Replies
View Related
Jul 23, 2005
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?
View 1 Replies
View Related
Jul 23, 2005
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.
View 1 Replies
View Related
Jul 20, 2005
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:
View 6 Replies
View Related
Oct 15, 2009
I have a site with 5000 pages.
I need to add the onbeforeunload event to the body tag of each form. How can i do this programatically using javascript.
i would like to loop through the form, find the body tag append the onbeforeunload event.
(also, i would like to all href's) on each page.
this is what i have so far but it does not bring the body tag or hrefs's
<code>
function GetElementsFromForm()
{
//document.formOne.elementOne
//document.forms[0].elements[0]
[Code]....
View 1 Replies
View Related
Oct 13, 2009
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
View 2 Replies
View Related
Jun 11, 2010
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.
View 1 Replies
View Related
Feb 17, 2011
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?
[Code]....
View 5 Replies
View Related
Jan 2, 2009
I have this code in a page that appears in my iframe if requested from parent:
<script type="text/javascript">
parent.rrr();
</script>
The parent code is:
function rrr() {
javascript:location.reload(true);
}
So, the person clicks a link from the parent, it does a php process in a hidden iframe, which then tells the parent page to refresh. The only problem is that it puts Firefox in a constant loop of refreshing. IE and Chrome work fine. They refresh once and stop.
Though the src code opens the iframe like so: <iframe src="" style="display:none; height:1px;" name="hdplus" id="hdplus"></iframe> Firefox seems to refresh the page with the memory of the child page being in the iframe, constantly looping the child request to refresh the parent.
Why won't Firefox just accept that no page should load in the iframe, as stated in the code? I need to stop this loop, which means I need to get firefox to reset the iframe as it reloads the page.
View 2 Replies
View Related
Aug 11, 2009
How to refresh DIV , without refresh entire page,Am having four DIV ,
DIV1,DIV2,DIV3,DIV4
I want to refresh only DIV! without affecting the DIV3,DIV4 ,
View 8 Replies
View Related
Apr 13, 2011
I have the below code:
<script type="text/javascript">
function loadQuickMessageCheck(File,ID){
var xmlhttp;
[code]....
View 2 Replies
View Related
Mar 25, 2010
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.
View 3 Replies
View Related
Apr 15, 2010
So my problem is that i can't send form data in FF without page refresh (though in IE7-8 everything works smoothly).
My code fragments:
View 1 Replies
View Related
Jul 20, 2005
I'm trying to use JS to move the cursor from my user login text field
to the password text field - I've put the onKeyPress() event in the
user input tag but then I press the Tab key the cursor doesn't move -
function detect_tab_key()
{
var key_code = window.event.keyCode;
if (key_code == 9)
{
document.forms[0].frm_password.focus();
document.forms[0].frm_password.select();
}
}
View 1 Replies
View Related
Jun 26, 2009
I would to change the color of some td cells if there is text in it. Right now this code does the job, but it changes the color of evry table. I'd like to know a way to do this on one table in my page and not all of them.
var count='0';
var TDs=document.getElementsByTagName('td')
var length=TDs.length;
i='0';
[Code]....
View 3 Replies
View Related
Oct 1, 2007
example: onkeypress="return eventHandlerFunction(event)"
Why is it that you need the return keyword?
Where does the argument event come from?
I know it works, I just want to know why it works.
I've been looking at some refferences and can't seem to find an answer if someone could give me an explanation or point me to a website, that would be great.
View 2 Replies
View Related
Oct 5, 2007
I am trying to do something I thought would be simple in javascript, and I'm at a loss. First code is GOOD code, except that it does not account for the possibility that the button(s) in question do NOT exist. The second and third subsets are two of several attempts to do just that. Code:
View 2 Replies
View Related