1

We are calling a javascript from inside our ASPX page.As described below:

 <script type="text/javascript">

    var resultados = false;

    function change_source(iframe)
     {
        iframe.src = 'someURL/index.jsp?querystringparametervalues';
        return true;
      }

      window.onerror = function()
       {
         if (typeof window.resultados === "undefined")
          {
             resultados = false;
          }
        return true;
      }
    </script>

<iframe width="100%" height="330" frameborder="0" 
  scrolling="no" onload="change_source(this);" >
</iframe>

Error Description :

IFrame is calling some remote javascript where in a variable called 'resultados' is undefined.we are trying to ignore the error locally (local javascript).But still we are getting the same error "Object undefined".

How to suppress remote javascript so that it won't break the execution?

Note : We are only concentrating on IE

Update :

We have tried something silly like

disabling

(i) ValidateRequest="false" (ii) EnableEventValidation="false" in Page directive.

Is there any work around from server side like "HttpRequest" / "HttpResponse" /"HttpHandler" / "HttpContext" object will catch these kind of exception and ignore it.

The problem is whenever we receive such error IDE opens up "Continue/Ignore/Break" MessageBox which is quite annoying.

I would be very greatful if someboday guide me to resolve it.

Thank you in advance!

user992910
  • 13
  • 3
  • I think you should add `onerror="return true"` to the iframe, too, since they are different `window`s. Not sure though, could you try it? – pimvdb Oct 13 '11 at 07:40
  • @pimvdb : By doing so i am receiving warning message "onerror" is not a valid attribute of IFrame – user992910 Oct 13 '11 at 07:46
  • Not sure then, but perhaps this question is interesting: http://stackoverflow.com/questions/1353664/how-to-catch-javascript-errors-in-all-iframes-with-window-error. – pimvdb Oct 13 '11 at 07:48

0 Answers0