-
onbeforeunload event and javascript protocol
<a href='javascript: window.alert("hello world!");'>Click here</a>
In IE 5.5, clicking this link will cause the window.onbeforeunload() event to
fire. Is this a bug? Is there any workaround?
According to MSDN, the onbeforeunload event should fire only if the <A> "refers
the browser to another Web page".
-- Matthew Solnit
-
Re: onbeforeunload event and javascript protocol
Matthew,
it seems like it is an error but it is m$ after all!
The following code will execute the javascript statement and the onBeforeUnLoad
event won't be fired.
<a href="nowhere.html" onClick="JavaScript:window.alert('hello world!');return
false;">Click here</a>
Let me know if this isn't what you are after.
Stu.
"Matthew Solnit" <msolnit@nospam.yahoo-com> wrote:
><a href='javascript: window.alert("hello world!");'>Click here</a>
>
>
>In IE 5.5, clicking this link will cause the window.onbeforeunload() event
to
>fire. Is this a bug? Is there any workaround?
>
>According to MSDN, the onbeforeunload event should fire only if the <A>
"refers
>the browser to another Web page".
>
>-- Matthew Solnit
>
>
-
Re: onbeforeunload event and javascript protocol
"Stuart" <stuartv@prologic.com.au> wrote in message
news:3b562f12$1@news.devx.com...
> The following code will execute the javascript statement and the
onBeforeUnLoad
> event won't be fired.
>
> <a href="nowhere.html" onClick="JavaScript:window.alert('hello world!');return
> false;">Click here</a>
Thanks for your reply. We have been doing something very similar. The only
difference is that we use href="#" instead, so that the status bar does not show
a fake URL during a mouseover.
Just out of curiousity, do you know if other browsers behave as expected?
-- Matthew Solnit
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks