How to display errors on web browsers without dev tools (like the Switch)
-
If you're working on a website for a console that doesn't have a modern browser, or web dev tools, and can't figure out why something is broken on the console, the following HTML snippet can be used to display and alert any javascript errors:
<script> window.onerror = function(message, source, lineno, colno, error) { alert(`Error: ${message}\nSource: ${source}\nLine: ${lineno}\nColumn: ${colno}\nError object: ${error}`); return false; }; </script>This will only help for websites where you can control the source code. It displays whatever errored on the page, and the filename and line number that generated it.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better ๐
Register Login