How to Suppress the JavaScript error tht pops up while printing the WebBrowser content?
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.
精彩评论