开发者

How to Suppress the JavaScript error tht pops up while printing the WebBrowser content?

开发者 https://www.devze.com 2023-01-15 22:07 出处:网络
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 programat开发者_运维知识库ically after each URL gets loaded . But, I

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 programat开发者_运维知识库ically 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.


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


try catch block you mean?

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

But it's better to solve the error.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号