Welcome Guest Search | Active Topics | Sign In | Register

problem with window.onbeforeunload and eo:Menu Options
testing32
Posted: Wednesday, November 28, 2007 12:32:53 PM
Rank: Newbie
Groups: Member

Joined: 10/29/2007
Posts: 4
Hey guys, I was wondering if you could help me with a quick issue that I'm having.

I have window.onbeforeunload on a page. When I select an item from the eo:Menu to navigate away from the page I see the onbeforeunload window as expected.
If I click "Ok" everything works fine and the page navigates.
If I click "Cancel" an unhandled exception is recieved.
It is failing at this location:

function _eofu_co(a,b){if(!b||(b=="_self"))window.location.href=a;

Thanks in advance.
eo_support
Posted: Wednesday, November 28, 2007 2:06:56 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You will want to use ClientSideOnItemClick instead of onbeforeunload to confirm whether user wants to leave the current page:

Code: HTML/ASPX
<eo:Menu ruant="server ClientSideOnItemClick="on_item_click" ....>
......
</eo:Menu>


Code: JavaScript
function on_item_click(e, info)
{
    if (!window.confirm("Are you sure"?))
        eo_CancelEvent();
}


onbeforeunload always causes an exception when canceled while navigating away from the current page by script. So you want to avoid using that with our menu because our menu navigate away from the current page by script.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.