views:

59

answers:

2

Hi All,

In my windows application I'm loading more than 100 urls in my web browser control one by one in a for loop and need to print them programatically after each URL gets loaded . But, I keep getting the Javascript error for so many URLs. I'm not sure why this error keep coming. Can anyone help me on how to suppress the javascript error through code and proceed. Thank you.

A: 

try catch block you mean?

for() {
    try{
      //your code
    }
    catch(err){
      //error handling
    }
}

But it's better to solve the error.

Mark Baijens
A: 

This is really bad to do (because it's always best to solve the error rather than suppress it). I don't recommend it, but if it helps you out:

<script language="JavaScript">
<!--
function silentErrorHandler() {return true;}
window.onerror=silentErrorHandler;
//-->
</script>

from http://www.javascripter.net/faq/suppress.htm

Joel Etherton
Hi Joel, Thank for your reply. My requirement is tht I have an XML file which has a collection of URLs. My windows application which will be scheduled to run once in everyday will have to print the webpages in each URLs in the XML as a PDF file through nova PDF convertors. This is an automated process.
and also where do i write a javascript function in a Windows application??