
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to handle errors in HTML5 Web Workers?
The following shows an example of an error handling function in a Web Worker JavaScript file that logs errors to the console.
Example
<!DOCTYPE HTML> <html> <head> <title>Big for loop</title> <script> var worker = new Worker('bigLoop.js'); worker.onmessage = function (event) { alert("Completed " + event.data + "iterations" ); }; worker.onerror = function (event) { console.log(event.message, event); }; function sayHello(){ alert("Hello sir...." ); } </script> </head> <body> <input type = "button" onclick = "sayHello();" value = "Say Hello"/> </body> </html>
- Related Questions & Answers
- Stop Web Workers in HTML5
- How to handle Geolocation errors in HTML5?
- Why HTML5 Web Workers are useful?
- How can I use Web Workers in HTML5?
- Log error to console with Web Workers in HTML5
- How to handle errors within WaitGroups in Golang?
- How to handle errors in middleware C# Asp.net Core?
- How to handle errors while working with Navigation in ReactNative?
- How to handle web based alerts in Selenium?
- How can MySQL handle the errors during trigger execution?
- How to handle the errors generated while deserializing a JSON in Java?
- How to check web browser support in HTML5
- How to handle HTML5 media events using jQuery?
- How to handle mousedown and mouseup with HTML5 Canvas
- Html5 responsiveness of the web
Advertisements