Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to prevent JavaScript from displaying errors?

Featured Replies

How would I prevent JavaScript from displaying errors?

 

My script runs fine on all browsers except for IE6 it alerts the user of a problem on line such and such of script this and that.

 

So how do I turn off errors? Or is this possible?

OK im going to try and shed some light as im still learning myself, But i think there is a javascript code for trapping errors and controlling what they do.

 

http://www.w3schools.com/js/js_onerror.asp

 

The link above will help shed better light than i can but it should help to maybe trap the error into sets so you can hide the display for simple errors that dont effect the user or have them flagged up if there going to interfere with the users forms/exsperiance.

 

Hope that helps

  • Author
OK im going to try and shed some light as im still learning myself, But i think there is a javascript code for trapping errors and controlling what they do.

 

http://www.w3schools.com/js/js_onerror.asp

 

The link above will help shed better light than i can but it should help to maybe trap the error into sets so you can hide the display for simple errors that dont effect the user or have them flagged up if there going to interfere with the users forms/exsperiance.

 

Hope that helps

 

Thanks I'll check it out.

  • Author
Pleased i could help if it does :-).. Not used ie6 alot .....

 

Yes. I wish I didn't have to support IE6, but sadly this site must support all browsers. :(

In this case some thing i learn the other day was that you have to use behaviors to show png files in IE6 just making sure you know this as this caught me out once when i viewed a site on IE6

  • Author

Well, I tried the function and couldn't get it working but I did find this handy little script so all you have to do to disable errors is put this in the <head> of your document:

 

<script type="text/javascript"> function noError(){return true;} window.onerror = noError; </script>

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.