What is HTML5 web workers
In this article I have described the web workers in HTML5
Web Worker(s) are supported by the following browsers.
|Fire fox v3.5
Note: Browser Earlier versions, do not support web workers.
Example of web workers for iterations
<title>Bigger for loop</title>
for (var i = 0; i <= 10000000000; i += 1)
var j = i;
alert("Completed " + j + "iterations" );
alert("Hi Hello jee...." );
<input type="button" onclick="Loop();" value="B_Loop" />
<input type="button" onclick="Hello();" value="Hello" />
My 1st Web Worker
HTML5 Web Workers will be executed on separated threads, you need to host their code into separated files from the main page. Web Workers and the main page are communicating via messages. Those messages can be rmed with normal strings. To illustrate simple message posting, we're going to start by reviewing a very basic sample. It will post a string to a worker that will simply concatenate it with something else. To do that, add the following code into the "Bigger for loop/Hi Hello jee is msg" file.
You may also want to read these related articles :
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here