Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2009-10-05 13:10:52

calebmei
New member
Registered: 2009-08-24
Posts: 7

Alert before close browser (onBeforeUnload)

Hi there,

I am trying to add a confirm dialog box when user attempt to close browser, and show a message to the user that changes might not have been saved.

So I tried to add a onBeforeUnload event to the <body> of the HTML. However, because "save" in Xinha is actually reloading the form, the event is being launched when the user is saving the content rather than exit browser.

Also attempted to hook in as a plug in, and same effect.

I saw the "SaveSubmit" plugin actually can detect changes and change the icon to a save button with "red" indicator. Perhaps I should review and add more code to the SaveSubmit plugin and add the hook to listen to onBeforeUnload?

So anyone has tried to launch a confirm dialog before exit browser?

Thanks in advance.

Cheers,
Calebmei

Offline

#2 2009-11-10 09:46:25

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: Alert before close browser (onBeforeUnload)

I wouldn't have thought Xinha would mess with an onunload event.  That said.  I vaguely recall that onunload when actually closing a window doesn't work.

Maybe that's old knowledge though.


James Sleeman

Offline

Board footer

Powered by FluxBB