I've played around a bit. for testing I run the following code when in
the onclose callback:
var test = _getBrowser().contentWindow.close();
alert(test);
and found out the following situations:
1. Closing a window without the warning about unsaved changes:
_getBrowser().contentWindow.close() returns undefined
2. Closing a window with the warning and clicking on cancel:
_getBrowser().contentWindow.close() returns undefined
3. Closing a window with the warning and clicking on ok:
for some reason the alert box is not shown
can someone explain to me how to handle the warning dialog and
distinguishing between a click on Ok and Cancel?
Cheers,
Nico
I've started Prism that loads a web page.
On this web page, I double-click on an icon that calls window.open()
to load another URL in a new window.
The new window opens.
I click on the "X" of the new window to close it.
In this situation the variable this._xulWindow in WebRunner.tryClose()
is null.
tryClose : function()
{
var contentViewer = this._xulWindow.docShell.contentViewer;
if (contentViewer && !contentViewer.permitUnload()) {
return false;
} else {
return true;
}
},
This is not the case for the first window. Any suggestions how to fix
that?
Here is the code that initializes the variable:
this._xulWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIXULWindow);
Thanks in advance.
Cheers,
Nico
> --
>
> You received this message because you are subscribed to the Google Groups "mozilla-labs-prism" group.
> To post to this group, send email to mozilla-l...@googlegroups.com.
> To unsubscribe from this group, send email to mozilla-labs-pr...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mozilla-labs-prism?hl=en.
>
>
>
I'm not sure what that code is supposed to do, but perhaps the DOM
event "onbeforeunload" will do what you want.