Welcome Guest! (App Version 3.1)

websitnero logo name

Web Workers

Using Web Workers in HTML5

Though the name seems pretty complex, these are nothing but the pieces of JavaScript that run in the background so that the webpage performance is not affected. So, simply we can say that web-workers are JavaScript code snippets that run behind the scenes without affecting the user experience on the client side or the browser.

Example

<input type="button" onclick="sayHello();" value="Say Hello" />

<script>

var worker = new Worker('webworker.js');

worker.onmessage = function (event) {
  alert("Completed " + event.data + "iterations" );
};

function sayHello(){
  alert("Hello sir...." );
}

</script>

webworker.js

for (var i = 0; i <= 1000000000; i += 1){
  var j = i;
}

postMessage(j);
WebsiteNero is highly optimized for learning various website developing technlogies. We try our best to add maximum modules and examples to help learn the concepts clearly and vividly. We try to present all content and examples as simple as we can removing any complexity to hurdle easy understanding. We try best provide you with worthful content, but we cannot guarantee full correctness of all the content on this site. While using this website, you agree to have read and accepted all our terms of use and conditions, cookie, and privacy policy. Copyright, 2013-2018 by websitenero.com. All Rights Reserved.