
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
How can I use Web Workers in HTML5?
Web Workers allow for long-running scripts that are not interrupted by scripts that respond to clicks or other user interactions and allows long tasks to be executed without yielding to keep the page responsive.
Web Workers are background scripts and they are relatively heavyweight and are not intended to be used in large numbers. For example, it would be inappropriate to launch one worker for each pixel of a four-megapixel image.
Web Workers initialized with the URL of a JavaScript file, which contains the code the worker will execute. This code sets event listeners and communicates with the script that spawned it from the main page.
Syntax
Following is the syntax −
var worker = new Worker('bigLoop.js');
- Related Articles
- Stop Web Workers in HTML5
- How to handle errors in HTML5 Web Workers?
- Why HTML5 Web Workers are useful?
- Log error to console with Web Workers in HTML5
- How can I use the HTML5 canvas element in IE?
- What ECMAScript 6 features can I currently use in web browsers?
- Use of Ionic as desktop web application with HTML5
- What are different Navigator properties I can use on my web page?
- How can I handle Server-Sent Events in HTML5?
- How to check web browser support in HTML5
- How can I turn on error information in my Web Browser?
- How do we embed audio in web pages in HTML5?
- Html5 responsiveness of the web
- How can I display an image inside SVG circle in HTML5?
- How can I scroll a web page using selenium webdriver in python?

Advertisements