Skip to content
  • Categories
  • Recent
  • Groups
  • Users
  • Tags
  • Popular
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Lumen)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Categories
  3. Web Development
  4. How to display errors on web browsers without dev tools (like the Switch)

How to display errors on web browsers without dev tools (like the Switch)

Scheduled Pinned Locked Moved Web Development
1 Posts 1 Posters 99 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • VGMooseV Offline
    VGMooseV Offline
    VGMoose
    Admin
    wrote on last edited by
    #1

    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.

    Sign the petition! Help us figure out the browser timeout.

    1 Reply Last reply
    1
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Groups
    • Users
    • Tags
    • Popular