HTML 5 webworkers with multiple arguments
问题 I just got into HTML5 webworkers and now I want to pass multiple arguments to my worker. I have this in my page: var username = document.getElementById("username").value; var server_url = 'localhost'; w.postMessage(username,server_url); and this in my worker: var username = ''; var server_url = ''; onmessage = function (e,f) { username = e.data; server_url = f.data; } console.log(username); console.log(server_url); and when I open it the page which calls the worker in the browser: Uncaught