Set a flag ignoreNextUnload before you call LzBrowser.loadJS (myScript) and clear it in the onbeforeunload handler.

window.onbeforeunload = function() {
  if (ignoreNextUnload) {
      ignoreNextUnload = false;
  } else {
     // present a confirmation dialog
  }
}


On Dec 25, 2006, at 12:51 PM, Henry Minsky wrote:

Maybe someone else has an idea what this issue is?

Which browser are you using, and which Operating System?

---------- Forwarded message ----------
From: Rami Alkhalyleh <[EMAIL PROTECTED]>
Date: Dec 25, 2006 2:33 PM
Subject: Re: Chat with Rami Alkhalyleh
To: Henry Minsky < [EMAIL PROTECTED]>

Hi,

 Can you help me,

I'm facing a problem when i call LzBrowser.loadJS(myScript) it triggers the event onbeforeunload. I'm using a handler to the onbeforeunload event in my html page in which I had embedded the laszlo application so that a confirmation message is shown to the user before he closes or refreshes the browser.
   sample code:
   window.onbeforeunload = function () {
        var msg = 'Are you sure you want to exit?!!!';
        if (typeof oEvent == 'undefined') {
             oEvent = window.event ;
         }
         if (oEvent) {
             oEvent.returnValue = msg ;
          }
         return msg;
   }
I did see alot of discussion going on the forums to solve this problems and one suggestion was to detect the clientX and clientY mouse coordinates when
   the event occures but that will not help when Alt F4 is used or F5.
I just want the onbeforeunload event be triggered only when the browser is

- Ignored:
going to be closed, refreshed or the url changes, but not when i execute
   LzBrowser.loadJS(scr)

   Please any body could help me with this issue.

   Thanks in advance

Rami


On 12/25/06, Rami Alkhalyleh < [EMAIL PROTECTED]> wrote: Thanks


On 12/25/06, Henry Minsky < [EMAIL PROTECTED]> wrote: Can you post an email with a description of your issue to the openlaszlo dev list? Then everyone can contribute and see the answer, there might be others who have the same problem or would contribute a solution.

Chat with Rami Alkhalyleh <[EMAIL PROTECTED]> on 12/25/06:
1:53 PM Rami: hello
 me: to whom do I have the pleasure of addressing?
1:54 PM Rami : i'm working on a laszlo application and i want to ask about some issue. I want to ask about the LzBrowse.loadJS and onbeforeunload event handling



--
Henry Minsky
Software Architect
[EMAIL PROTECTED]





--
Henry Minsky
Software Architect
[EMAIL PROTECTED]


Benjamin Shine
Software Engineer, Open Laszlo / Laszlo Systems
[EMAIL PROTECTED]



Reply via email to