I have the following line in my JavaScript file, which creates an error message on the console:
myObject.width = 315;
I want to hide this error message on the console. I mean that, this line of code will run, it will give error, but won't display it on the console log.
I read about window.onerror
, but it did not work. As I understand, this disables all the errors on a page, however I want to disable the errors of only my line. I tried putting it right after, but it didn't work either:
myObject.width = 315;
window.onerror = function(){
return true;
}
Is there any workaround for this? Thanks.