Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect browser internal JavaScript errors?

We are currently logging all JavaScript errors. However, some errors seem to be browser internal (plugin, etc) related. Like this one:

Error: Error calling method on NPObject!

Line: 0

Script: http://www.lookr.com/lookout/1329030315-Giglio-Porto


How is it possible to ignore those browser internal, non-directly-website-related errors?


  • Ignoring all errors with line 0 also seems not appropriate, since inline JavaScript errors would also be ignored (which is not desired)

Thank you in advance for your suggestions.

like image 708
Simon Ferndriger Avatar asked Dec 19 '13 09:12

Simon Ferndriger


People also ask

How do I check for JavaScript errors?

Right-click anywhere in the webpage and then select Inspect. Or, press F12 . DevTools opens next to the webpage. In the top right of DevTools, the Open Console to view errors button displays an error about the webpage.

How do you detect which browser is being used JavaScript?

How to detect the user browser ( Safari, Chrome, IE, Firefox and Opera ) using JavaScript ? The browser on which the current page is opening can be checked using JavaScript. The userAgent property of the navigator object is used to return the user-agent header string sent by the browser.

Where are JavaScript errors in Chrome?

In Chrome, navigate to View > Developer > JavaScript Console or More Tools > JavaScript Console or press Ctrl + Shift + J. The error console will open. If you don't see any errors try reloading the page. The error may be generated when the page loads.


1 Answers

This is the closest that you can get (onerror)

<html>
<body>
    <script>
        window.onerror = function(e) {
            alert('Error');
            console.log(e);
        }
        show('Error'); // show is not defined
    </script>
</body>
</html>
like image 70
Patt Mehta Avatar answered Sep 19 '22 22:09

Patt Mehta