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;








0















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)










share|improve this question






















  • 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












  • 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

















0















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)










share|improve this question






















  • 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












  • 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













0












0








0








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)










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 21:52









gtryonpgtryonp

197211




197211












  • 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












  • 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












  • 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












1 Answer
1






active

oldest

votes


















1














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);






share|improve this answer























  • 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











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
);



);













draft saved

draft discarded


















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









1














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);






share|improve this answer























  • 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















1














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);






share|improve this answer























  • 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













1












1








1







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);






share|improve this answer













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);







share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support 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!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved