Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > onBeforeUnload Alternative

Reply
Thread Tools

onBeforeUnload Alternative

 
 
lltaylor
Guest
Posts: n/a
 
      07-19-2004
Hello,

Currently I use an onbeforeunload method, to do call various tidy up
methods
when a user exits my web application - however I now need to add
additional support, for users migrating to Sun's JVM.

My understanding that the onbeforeunload call is a Microsoft one, and
the net
result of having it in a page used by a SUN JVM user is that the
browser does not close.

Does anyone know of an alternative to this method, that is supported
by Sun's JVM??????

Thanks in advance

Lloyd
 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      07-23-2004
Lloyd Taylor wrote:

> No URL to offer as it run on an internal apache:tomcat server.
>
> The onbeforeunload call is made in the body tag,


You probably meant to say that in the start tag of the "body" element there
is a "onbeforeunload" attribute which causes the (one) user agent you have
tested with to execute its value as script code on a certain event.

> which in turn calls myCleanUpMethod()
> <body onbeforeunload="myCleanUpMethod()" >


And what is myCleanUpMethod()? You could have provided this,
but now it really does not matter anymore (see below).

> The method onBeforeUnload is a JSCRIPT method which fires prior to a page
> being unloaded.


No, it is an intrinsic event handler of the IE(4+) DOM, thus it works only
in this user agent and, BTW, using the handler within HTML context makes the
document invalid or, strictly speaking, no HTML at all:

<http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onbeforeunload.asp>
<http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.3>

Coincidental the ECMAScript implementation that IE supports is JScript,
but that has nothing to do with the UA's DOM. For example, with IE
VBScript code could be executed in the listener.

> It is not supported in Sun's JVM (hangs the browser)


Nonsense. Java != J(ava)Script. Sun provides a _Java_
Virtual Machine, not a J(ava)Script Virtual Machine.

<http://jibbering.com/faq/#FAQ2_2>

> and I was hence wondering if there was an alternative in javascript,
> the onUnload isn't any good as it fires too late.


Revise your Web application, its concept is flawed.

> [Top post]


<http://jibbering.com/faq/#FAQ2_3>


PointedEars
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Quicktime Alternative, RealPlayer Alternative & Media Player Classic John Capleton Computer Support 3 12-05-2005 07:41 AM
Help on onbeforeunload event to alert on close of window(X) RJN ASP .Net 1 09-29-2004 07:54 PM
onbeforeunload event behaves weirdly RJN ASP .Net 1 09-24-2004 07:43 PM
onbeforeunload event is fired twice Rick Lubanovic ASP .Net 0 10-30-2003 08:55 PM
OnBeforeUnload event...where to run code BEFORE return msg? Kathy Burke ASP .Net 0 08-04-2003 06:13 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57