3 Replies Latest reply on Sep 18, 2008 5:18 AM by ilya_shaikovsky

    onbeforeunload "Unspecified Error" in IE6

    frosted

      Hi,

      I am writing an application for IE 6 using RichFaces (I hope this evokes SOME sympathy from all - hehe) and I am using an onbeforeunload event to trap form changes and ask the user if they really want to navigate to another page. I have the code working (albeit with some hacks, it was asking twice at first), but when the user hits cancel I get an "Unspecified Error" Javascript error. After some research, I found that this occurs when eval() is called in Javascript (and ONLY in IE6), and the solution is to surround the eval() function with a try/catch block (in Javascript). Now, I don't have access to the function call since it is part of Richfaces (or maybe just JSF in general, I am not sure).

      Has anyone run into this issue and if so, knows of a way around it. It's not a complete show stopper as show every javascript error is not enabled by default, but I'd like to not have that ugly yellow triangle come up every time a user cancels a page.

      Any help/advice is greatly appreciated.

      Thanks.

        • 1. Re: onbeforeunload
          ilya_shaikovsky

          Use onsubmit on the a4j:support component or onclick on button or link components in order to place your confirms.

          • 2. Re: onbeforeunload
            frosted

            There are a number of ways the user can leave the page (tab headers, links, single select which triggers another user being loaded, as well as closing the window), so this is not really a viable solution, as they are all not form submits. During all of these occurrences (minus the window being closed), is the form submitted?

            • 3. Re: onbeforeunload
              ilya_shaikovsky

              ok. let us see your code snippet please for concrete case.