Avoid chrome “pages unresponsive” upon javascript long execution Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How to execute a JavaScript function when I have its name as a stringChange the selected value of a drop-down list with jQueryJavaScript that executes after page loadScroll to the top of the page using JavaScript/jQuery?How to reload a page using JavaScriptHow to decide when to use Node.js?Is the recommendation to include CSS before JavaScript invalid?How to set a JavaScript breakpoint from code in Chrome?How does Access-Control-Allow-Origin header work?Disabling Chrome Autofill
Does the Mueller report show a conspiracy between Russia and the Trump Campaign?
Deconstruction is ambiguous
Can the Flaming Sphere spell be rammed into multiple Tiny creatures that are in the same 5-foot square?
What does Turing mean by this statement?
Why can't I install Tomboy in Ubuntu Mate 19.04?
How does light 'choose' between wave and particle behaviour?
A term for a woman complaining about things/begging in a cute/childish way
Most bit efficient text communication method?
Dyck paths with extra diagonals from valleys (Laser construction)
What is the difference between a "ranged attack" and a "ranged weapon attack"?
Co-worker has annoying ringtone
Tannaka duality for semisimple groups
Why are my pictures showing a dark band on one edge?
How would a mousetrap for use in space work?
Converted a Scalar function to a TVF function for parallel execution-Still running in Serial mode
Why are vacuum tubes still used in amateur radios?
How long can equipment go unused before powering up runs the risk of damage?
How does Belgium enforce obligatory attendance in elections?
The test team as an enemy of development? And how can this be avoided?
1-probability to calculate two events in a row
Semigroups with no morphisms between them
Do I really need to have a message in a novel to appeal to readers?
Is there hard evidence that the grant peer review system performs significantly better than random?
Why do early math courses focus on the cross sections of a cone and not on other 3D objects?
Avoid chrome “pages unresponsive” upon javascript long execution
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How to execute a JavaScript function when I have its name as a stringChange the selected value of a drop-down list with jQueryJavaScript that executes after page loadScroll to the top of the page using JavaScript/jQuery?How to reload a page using JavaScriptHow to decide when to use Node.js?Is the recommendation to include CSS before JavaScript invalid?How to set a JavaScript breakpoint from code in Chrome?How does Access-Control-Allow-Origin header work?Disabling Chrome Autofill
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a javascript LONG execution procedure (and reasons to have it). How can I avoid in javascript the message on the client machines? I read something about
--disable-hang-monitor, but is a command line argument or setting, not javascript (also, I read isnt working allways)
javascript google-chrome message
add a comment |
I have a javascript LONG execution procedure (and reasons to have it). How can I avoid in javascript the message on the client machines? I read something about
--disable-hang-monitor, but is a command line argument or setting, not javascript (also, I read isnt working allways)
javascript google-chrome message
Doasync
anddefer
attributes on script tags solve the problem?
– Ali Sheikhpour
Mar 8 at 21:58
In most cases there should be no valid reasons to have such scripts. You say that you have "reasons", what are they? What is the code doing?
– battlmonstr
Mar 8 at 22:07
Thanks Ali Sheikhpour for your comment. but neither async nor defer avoid the message when the scripts takes a long time.
– gtryonp
Mar 10 at 6:23
Thanks battlmonstr for your comment. (In short: A project to create software capable to write code business logic by itself), But please focus in help us -if you know how- with the question.
– gtryonp
Mar 10 at 6:44
add a comment |
I have a javascript LONG execution procedure (and reasons to have it). How can I avoid in javascript the message on the client machines? I read something about
--disable-hang-monitor, but is a command line argument or setting, not javascript (also, I read isnt working allways)
javascript google-chrome message
I have a javascript LONG execution procedure (and reasons to have it). How can I avoid in javascript the message on the client machines? I read something about
--disable-hang-monitor, but is a command line argument or setting, not javascript (also, I read isnt working allways)
javascript google-chrome message
javascript google-chrome message
asked Mar 8 at 21:52
gtryonpgtryonp
197211
197211
Doasync
anddefer
attributes on script tags solve the problem?
– Ali Sheikhpour
Mar 8 at 21:58
In most cases there should be no valid reasons to have such scripts. You say that you have "reasons", what are they? What is the code doing?
– battlmonstr
Mar 8 at 22:07
Thanks Ali Sheikhpour for your comment. but neither async nor defer avoid the message when the scripts takes a long time.
– gtryonp
Mar 10 at 6:23
Thanks battlmonstr for your comment. (In short: A project to create software capable to write code business logic by itself), But please focus in help us -if you know how- with the question.
– gtryonp
Mar 10 at 6:44
add a comment |
Doasync
anddefer
attributes on script tags solve the problem?
– Ali Sheikhpour
Mar 8 at 21:58
In most cases there should be no valid reasons to have such scripts. You say that you have "reasons", what are they? What is the code doing?
– battlmonstr
Mar 8 at 22:07
Thanks Ali Sheikhpour for your comment. but neither async nor defer avoid the message when the scripts takes a long time.
– gtryonp
Mar 10 at 6:23
Thanks battlmonstr for your comment. (In short: A project to create software capable to write code business logic by itself), But please focus in help us -if you know how- with the question.
– gtryonp
Mar 10 at 6:44
Do
async
and defer
attributes on script tags solve the problem?– Ali Sheikhpour
Mar 8 at 21:58
Do
async
and defer
attributes on script tags solve the problem?– Ali Sheikhpour
Mar 8 at 21:58
In most cases there should be no valid reasons to have such scripts. You say that you have "reasons", what are they? What is the code doing?
– battlmonstr
Mar 8 at 22:07
In most cases there should be no valid reasons to have such scripts. You say that you have "reasons", what are they? What is the code doing?
– battlmonstr
Mar 8 at 22:07
Thanks Ali Sheikhpour for your comment. but neither async nor defer avoid the message when the scripts takes a long time.
– gtryonp
Mar 10 at 6:23
Thanks Ali Sheikhpour for your comment. but neither async nor defer avoid the message when the scripts takes a long time.
– gtryonp
Mar 10 at 6:23
Thanks battlmonstr for your comment. (In short: A project to create software capable to write code business logic by itself), But please focus in help us -if you know how- with the question.
– gtryonp
Mar 10 at 6:44
Thanks battlmonstr for your comment. (In short: A project to create software capable to write code business logic by itself), But please focus in help us -if you know how- with the question.
– gtryonp
Mar 10 at 6:44
add a comment |
1 Answer
1
active
oldest
votes
Assuming you are doing complex calculations that can't be broken down in smaller chunks, web workers seem to the solution to me.
It's the javascript mechanism to run code in a separate thread, but you have to communicate with that thread (called a worker) via messaging:
https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
var myWorker = new Worker('worker.js');
first.onchange = function()
myWorker.postMessage([first.value,second.value]);
console.log('Message posted to worker');
second.onchange = function()
myWorker.postMessage([first.value,second.value]);
console.log('Message posted to worker');
myWorker.onmessage = function(e)
result.textContent = e.data;
console.log('Message received from worker');
In the worker:
onmessage = function(e)
console.log('Message received from main script');
var workerResult = 'Result: ' + (e.data[0] * e.data[1]);
console.log('Posting message back to main script');
postMessage(workerResult);
I´ll try the monday. Thanks!
– gtryonp
Mar 10 at 6:45
1
After a while I tested it, and it works as you say (no more anoying messages even with long process). I didnt try all the features yet, but the basis works, Now on my library. Thanks!
– gtryonp
Mar 25 at 17:59
@gtryonp Happy that it worked out for you
– Markus
Mar 26 at 18:32
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55071504%2favoid-chrome-pages-unresponsive-upon-javascript-long-execution%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Assuming you are doing complex calculations that can't be broken down in smaller chunks, web workers seem to the solution to me.
It's the javascript mechanism to run code in a separate thread, but you have to communicate with that thread (called a worker) via messaging:
https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
var myWorker = new Worker('worker.js');
first.onchange = function()
myWorker.postMessage([first.value,second.value]);
console.log('Message posted to worker');
second.onchange = function()
myWorker.postMessage([first.value,second.value]);
console.log('Message posted to worker');
myWorker.onmessage = function(e)
result.textContent = e.data;
console.log('Message received from worker');
In the worker:
onmessage = function(e)
console.log('Message received from main script');
var workerResult = 'Result: ' + (e.data[0] * e.data[1]);
console.log('Posting message back to main script');
postMessage(workerResult);
I´ll try the monday. Thanks!
– gtryonp
Mar 10 at 6:45
1
After a while I tested it, and it works as you say (no more anoying messages even with long process). I didnt try all the features yet, but the basis works, Now on my library. Thanks!
– gtryonp
Mar 25 at 17:59
@gtryonp Happy that it worked out for you
– Markus
Mar 26 at 18:32
add a comment |
Assuming you are doing complex calculations that can't be broken down in smaller chunks, web workers seem to the solution to me.
It's the javascript mechanism to run code in a separate thread, but you have to communicate with that thread (called a worker) via messaging:
https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
var myWorker = new Worker('worker.js');
first.onchange = function()
myWorker.postMessage([first.value,second.value]);
console.log('Message posted to worker');
second.onchange = function()
myWorker.postMessage([first.value,second.value]);
console.log('Message posted to worker');
myWorker.onmessage = function(e)
result.textContent = e.data;
console.log('Message received from worker');
In the worker:
onmessage = function(e)
console.log('Message received from main script');
var workerResult = 'Result: ' + (e.data[0] * e.data[1]);
console.log('Posting message back to main script');
postMessage(workerResult);
I´ll try the monday. Thanks!
– gtryonp
Mar 10 at 6:45
1
After a while I tested it, and it works as you say (no more anoying messages even with long process). I didnt try all the features yet, but the basis works, Now on my library. Thanks!
– gtryonp
Mar 25 at 17:59
@gtryonp Happy that it worked out for you
– Markus
Mar 26 at 18:32
add a comment |
Assuming you are doing complex calculations that can't be broken down in smaller chunks, web workers seem to the solution to me.
It's the javascript mechanism to run code in a separate thread, but you have to communicate with that thread (called a worker) via messaging:
https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
var myWorker = new Worker('worker.js');
first.onchange = function()
myWorker.postMessage([first.value,second.value]);
console.log('Message posted to worker');
second.onchange = function()
myWorker.postMessage([first.value,second.value]);
console.log('Message posted to worker');
myWorker.onmessage = function(e)
result.textContent = e.data;
console.log('Message received from worker');
In the worker:
onmessage = function(e)
console.log('Message received from main script');
var workerResult = 'Result: ' + (e.data[0] * e.data[1]);
console.log('Posting message back to main script');
postMessage(workerResult);
Assuming you are doing complex calculations that can't be broken down in smaller chunks, web workers seem to the solution to me.
It's the javascript mechanism to run code in a separate thread, but you have to communicate with that thread (called a worker) via messaging:
https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
var myWorker = new Worker('worker.js');
first.onchange = function()
myWorker.postMessage([first.value,second.value]);
console.log('Message posted to worker');
second.onchange = function()
myWorker.postMessage([first.value,second.value]);
console.log('Message posted to worker');
myWorker.onmessage = function(e)
result.textContent = e.data;
console.log('Message received from worker');
In the worker:
onmessage = function(e)
console.log('Message received from main script');
var workerResult = 'Result: ' + (e.data[0] * e.data[1]);
console.log('Posting message back to main script');
postMessage(workerResult);
answered Mar 9 at 0:01
MarkusMarkus
1,21311230
1,21311230
I´ll try the monday. Thanks!
– gtryonp
Mar 10 at 6:45
1
After a while I tested it, and it works as you say (no more anoying messages even with long process). I didnt try all the features yet, but the basis works, Now on my library. Thanks!
– gtryonp
Mar 25 at 17:59
@gtryonp Happy that it worked out for you
– Markus
Mar 26 at 18:32
add a comment |
I´ll try the monday. Thanks!
– gtryonp
Mar 10 at 6:45
1
After a while I tested it, and it works as you say (no more anoying messages even with long process). I didnt try all the features yet, but the basis works, Now on my library. Thanks!
– gtryonp
Mar 25 at 17:59
@gtryonp Happy that it worked out for you
– Markus
Mar 26 at 18:32
I´ll try the monday. Thanks!
– gtryonp
Mar 10 at 6:45
I´ll try the monday. Thanks!
– gtryonp
Mar 10 at 6:45
1
1
After a while I tested it, and it works as you say (no more anoying messages even with long process). I didnt try all the features yet, but the basis works, Now on my library. Thanks!
– gtryonp
Mar 25 at 17:59
After a while I tested it, and it works as you say (no more anoying messages even with long process). I didnt try all the features yet, but the basis works, Now on my library. Thanks!
– gtryonp
Mar 25 at 17:59
@gtryonp Happy that it worked out for you
– Markus
Mar 26 at 18:32
@gtryonp Happy that it worked out for you
– Markus
Mar 26 at 18:32
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55071504%2favoid-chrome-pages-unresponsive-upon-javascript-long-execution%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do
async
anddefer
attributes on script tags solve the problem?– Ali Sheikhpour
Mar 8 at 21:58
In most cases there should be no valid reasons to have such scripts. You say that you have "reasons", what are they? What is the code doing?
– battlmonstr
Mar 8 at 22:07
Thanks Ali Sheikhpour for your comment. but neither async nor defer avoid the message when the scripts takes a long time.
– gtryonp
Mar 10 at 6:23
Thanks battlmonstr for your comment. (In short: A project to create software capable to write code business logic by itself), But please focus in help us -if you know how- with the question.
– gtryonp
Mar 10 at 6:44