[ 
https://issues.apache.org/jira/browse/TAP5-957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12888498#action_12888498
 ] 

Raul Montes commented on TAP5-957:
----------------------------------

Today I found a case where this bug is triggered even when (at least from what 
I know) good JavaScript practices are used: when you want an anchor used only 
to trigger some JavaScript behaviour you could, for example, set href="#" on 
the link, and then observe the click event. BUT the problem with this is that 
the "#" character is appended to the URL on the browser (unless you stop the 
event, which you cannot always do). Another way (and recommended) is to set 
href to "javascript:void(0)", which does absolutely nothing and you can observe 
the click event without any problem.

The problem is that, only in IE (of course...), this "javascript:void(0)" 
triggers the beforeunload event (like the javascript:show() reported in this 
issue) so this recommended practice for "unlinked links" is not possible in 
Tapestry.

I created a ticket a few months ago very related to this problem 
(https://issues.apache.org/jira/browse/TAP5-1115). I think changing the 
observed event from beforeunload to just unload should fix both issues. The 
issue TAP5-1115 has been apparently ignored :( even when I think is a big 
problem: if you click a link that downloads a file without leaving the page 
(which is very common), any Ajax behaviour stops working because of this.

Please, at least give us feedback about what you think for both of these issues.

> Unexcept "beforeunload" event generated by ie
> ---------------------------------------------
>
>                 Key: TAP5-957
>                 URL: https://issues.apache.org/jira/browse/TAP5-957
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.1.0.5
>            Reporter: mindhawk
>            Priority: Minor
>
> IE will generate a "beforeunload " event when a link such as "<a 
> href='javascript:show()'>show</a>"  is clicked. So Tapestry.windowUnloaded is 
> set to true. That means all ajax request have no chance to refresh the page 
> after this event.
> Now, I have to set Tapestry.windowUnloaded=false, every time I want to send a 
> ajax request. I don't think thisis a good practice. 
> I think there will be some more smart approach to replace 
> Tapestry.windowUnloaded, or just remove it. because, the request is sent to 
> the server no matter the value is true or false. This value is only discard 
> the responses from the server.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to