By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,835 Members | 1,391 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,835 IT Pros & Developers. It's quick & easy.

Page Load Cancel Event

P: n/a

I experimented with a snippet of JavaScript that will display a "Please
Wait" message and graphic while the results of a cgi script is running (the
script grabs a bunch of data and formats it in a table). Once the page has
loaded, the script clears the message and graphic. It works fine, however
if you click the button on the browser to cancel the page load, the browser
will render what it can of the table and the "Please Wait" message and
graphic is still displayed.

Is there an event that can be acted upon when the user clicks the browser's
cancel button that would allow me to turn the display of the message off?

Thanks
Nov 27 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
John Gault said the following on 11/27/2007 12:05 AM:
I experimented with a snippet of JavaScript that will display a "Please
Wait" message and graphic while the results of a cgi script is running (the
script grabs a bunch of data and formats it in a table). Once the page has
loaded, the script clears the message and graphic. It works fine, however
if you click the button on the browser to cancel the page load, the browser
will render what it can of the table and the "Please Wait" message and
graphic is still displayed.

Is there an event that can be acted upon when the user clicks the browser's
cancel button that would allow me to turn the display of the message off?
No. Clicking "Cancel" tells the browser to stop doing *anything* in the
page and to simply display what it can. Imagine though, if you could
trap the Cancel event, and a page author decided to re-call the
window.onload handler every time you did, where would you ever get to?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 27 '07 #2

P: n/a
On Nov 27, 6:04 am, Randy Webb <HikksNotAtH...@aol.comwrote:
John Gault said the following on 11/27/2007 12:05 AM:
I experimented with a snippet of JavaScript that will display a "Please
Wait" message and graphic while the results of a cgi script is running (the
script grabs a bunch of data and formats it in a table). Once the page has
loaded, the script clears the message and graphic. It works fine, however
if you click the button on the browser to cancel the page load, the browser
will render what it can of the table and the "Please Wait" message and
graphic is still displayed.
Is there an event that can be acted upon when the user clicks the browser's
cancel button that would allow me to turn the display of the message off?

No. Clicking "Cancel" tells the browser to stop doing *anything* in the
page and to simply display what it can. Imagine though, if you could
trap the Cancel event, and a page author decided to re-call the
window.onload handler every time you did, where would you ever get to?
He just wants to hide the status message, not reload the entire
procedure.

John, this should work for you
http://www.java2s.com/Code/JavaScrip...StopButton.htm

--
Kailash Nadh | http://kailashnadh.name

Nov 27 '07 #3

P: n/a
Kailash Nadh said the following on 11/27/2007 4:58 AM:
On Nov 27, 6:04 am, Randy Webb <HikksNotAtH...@aol.comwrote:
>John Gault said the following on 11/27/2007 12:05 AM:
>>I experimented with a snippet of JavaScript that will display a "Please
Wait" message and graphic while the results of a cgi script is running (the
script grabs a bunch of data and formats it in a table). Once the page has
loaded, the script clears the message and graphic. It works fine, however
if you click the button on the browser to cancel the page load, the browser
will render what it can of the table and the "Please Wait" message and
graphic is still displayed.
Is there an event that can be acted upon when the user clicks the browser's
cancel button that would allow me to turn the display of the message off?
No. Clicking "Cancel" tells the browser to stop doing *anything* in the
page and to simply display what it can. Imagine though, if you could
trap the Cancel event, and a page author decided to re-call the
window.onload handler every time you did, where would you ever get to?

He just wants to hide the status message, not reload the entire
procedure.
Who said he did? I said there is a potential for abuse if you can.
John, this should work for you
http://www.java2s.com/Code/JavaScrip...StopButton.htm
Test it in a non-IE browser.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 27 '07 #4

P: n/a

"Kailash Nadh" <ka**********@gmail.comwrote in message
news:35**********************************@o6g2000h sd.googlegroups.com...
On Nov 27, 6:04 am, Randy Webb <HikksNotAtH...@aol.comwrote:
>John Gault said the following on 11/27/2007 12:05 AM:
I experimented with a snippet of JavaScript that will display a "Please
Wait" message and graphic while the results of a cgi script is running
(the
script grabs a bunch of data and formats it in a table). Once the page
has
loaded, the script clears the message and graphic. It works fine,
however
if you click the button on the browser to cancel the page load, the
browser
will render what it can of the table and the "Please Wait" message and
graphic is still displayed.
Is there an event that can be acted upon when the user clicks the
browser's
cancel button that would allow me to turn the display of the message
off?

No. Clicking "Cancel" tells the browser to stop doing *anything* in the
page and to simply display what it can. Imagine though, if you could
trap the Cancel event, and a page author decided to re-call the
window.onload handler every time you did, where would you ever get to?

He just wants to hide the status message, not reload the entire
procedure.

John, this should work for you
http://www.java2s.com/Code/JavaScrip...StopButton.htm

--
Kailash Nadh | http://kailashnadh.name
Kailash,

Thank you. That worked.

JG
Nov 28 '07 #5

P: n/a
On Nov 28, 2:06 am, "John Gault" <fl...@tattoo-stories.comwrote:
"Kailash Nadh" <kailash.n...@gmail.comwrote in message

news:35**********************************@o6g2000h sd.googlegroups.com...
On Nov 27, 6:04 am, Randy Webb <HikksNotAtH...@aol.comwrote:
John Gault said the following on 11/27/2007 12:05 AM:
I experimented with a snippet of JavaScript that will display a "Please
Wait" message and graphic while the results of a cgi script is running
(the
script grabs a bunch of data and formats it in a table). Once the page
has
loaded, the script clears the message and graphic. It works fine,
however
if you click the button on the browser to cancel the page load, the
browser
will render what it can of the table and the "Please Wait" message and
graphic is still displayed.
Is there an event that can be acted upon when the user clicks the
browser's
cancel button that would allow me to turn the display of the message
off?
No. Clicking "Cancel" tells the browser to stop doing *anything* in the
page and to simply display what it can. Imagine though, if you could
trap the Cancel event, and a page author decided to re-call the
window.onload handler every time you did, where would you ever get to?
He just wants to hide the status message, not reload the entire
procedure.
John, this should work for you
http://www.java2s.com/Code/JavaScrip...criptingtheBro...
--
Kailash Nadh |http://kailashnadh.name

Kailash,

Thank you. That worked.
np John. But please keep in mind that the onstop event works only on
IE.
>
JG
--
Kailash Nadh | http://kailashnadh.name
Nov 28 '07 #6

P: n/a
VK
On Nov 27, 8:05 am, "John Gault" <fl...@tattoo-stories.comwrote:
Is there an event that can be acted upon when the user clicks the browser's
cancel button that would allow me to turn the display of the message off?
window.onabort = myEventHandler;

DOM 0, supported since Netscape 2.x
Nov 28 '07 #7

P: n/a
On Nov 28, 3:22 pm, VK <schools_r...@yahoo.comwrote:
On Nov 27, 8:05 am, "John Gault" <fl...@tattoo-stories.comwrote:
Is there an event that can be acted upon when the user clicks the browser's
cancel button that would allow me to turn the display of the message off?

window.onabort = myEventHandler;
Wonderful! Thank you :)
>
DOM 0, supported since Netscape 2.x
--
Kailash Nadh | http://kailashnadh.name
Nov 28 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.