How to stop Chrome throw unresponsive error? [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have a JavaScript + HTML program which includes a function taking long time to execute. The problem is, when I run this program on Chrome, Chrome throws unresponsive alert about 20 seconds after the long-time-taking-function starts its process. It is really annoying because I have to click wait button to delete the alert. Is it possible to make the unresponsive alert disabled by changing configuration of Chrome or by inserting some snippet in my JavaScript code?
Any information would be appreciated.
addition
I am sorry for not adding any code. My code is a bit complicated so I don't come up with a minimal reproducible example of my attempt. But I'm trying and please wait for a while.

No, the warning is just telling you that the browser is unresponsive. Disabling the warning wouldn't solve the underlying problem.
If you have long-running scripts (anything over a couple milliseconds should be considered long-running, your 20 second script would definitely be considered long-running), you should use asynchronous techniques: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous
Essentially your code will ask for a 'Promise' which then works in the background without stalling your browser or blocking other code. When it's resolved, the promise will come back to your code and you can use the results.

Related

How can I determine which JavaScript file makes my website slow? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
My website is http://hoopweb.com/. It suddenly loads so slowly. I know that it is because of a JavaScript file. Can someone help find the file? I can't experiment on all files due to some reasons.
You can open the developer tools and check in the network tab exactly which script is taking the longest time to load.
And as mayersdesign said, too many scripts = too many requests = longer page load time.
http://v2.zopim.com/bin/v/widget_v2.195.js is particularly slow, but in general you simply have too many scripts and too many loading in the head and not the footer.

Manipulating/Automating a web page from a Firefox Addon [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Is it possible to manipulate a loaded page of an open tab of Firefox, through a script that does this through a Firefox addon/extension? My goal is to fill out a form on a page, and then click submit.
Note: This cannot be done through readily available, 'user friendly' alternatives (for example Selenium), and can only be done with addon code, as the Firefox addon continuously calls a .dll file, waiting for an 'all clear, go ahead' from another program, that communicates with the .dll file. Also, solutions such as Selenium, take up too much processing time (even when we are dealing with seconds), which do not suit my case (i have already attempted using Selenium; it completes the task too slowly, and the .dll workaround is 'awkward').
So the question is, is possible to achieve something like this, and what will be required to do so, could you also please provide an example if possible. Thanks

Page only loads CSS and JavaScript after refresh [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
The first time I load the page it's a mess and JavaScript functions don't work. The second time it looks ok and works.
Any brief idea what might be causing this behaviour? I'm using Backbone.js and jQUery Mobile if that makes a difference.
Sorry for no code, but I need to go to a meeting in a moment and the website is huge so I don't really know what part to show you.
If anybody knows why this is happening and doesn't need to see the code, please help.
UPDATE:
Here's what seems to be the answer: https://forum.jquery.com/topic/script-not-running-unless-i-refresh-page
Thank you for suggestions, I upvoted the ones that seem relevant.
It sounds like unmet dependencies: some of your functions probably run before the document is fully loaded and can't get their job done correctly (missing elements, etc..). The second time the function work beacuse the page is cached and so loaed in time before the function starts.
I'd start looking at the JavaScript console and post the errors here if you can't figure it out alone, but without proper informations what we could do is just poor absumptions.
Might be javascript source could not be fetched from the url given. You can do inspect element and see what's happening on console or network tab.

What happens when a webpage is closed? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
1) What happens in the background when a webpage is closed?
2) How can I make the webserver think the page is still being viewed so my script may run?
I would post some code but I don't know where to start, looking for some terms and suggested methods to pursue, not necessarily code examples.
Example:
Let's say I have a javascript that needs to run for a certain amount of time once the user visits the page, but the user closes the page before it completes.
How can I (fake) the connection as being alive (even though the user left) until the script completes?
What happens in the background when a webpage is closed?
unload event is triggered and handled, script execution gets stopped, all webworkers get killed, everything gets cleaned up from memory, etc.
How can I make the webserver think the page is still being viewed so my script may run?
What however is possible to start an ajax request in your page which doesn't get killed by the server when the client aborts the request. In php for example you should take a look for that at ignore_user_abort().
You could try to warn user before leaving the page, and tell him that some work still needs to be done - but nothing more than that, the user will still be able to close the window/tab and your script will abort.
To warn the user, try this:
window.onbeforeunload = function() {
return 'Just give me a minute, please';
};

Javascript inconsistent behavior when website is deployed [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
We have an ASP.NET MVC website and the problem we have is this:
When the website is deployed, we see some strange Javascript related bugs, that never occur when running the website locally (on any of our computers).
For example:
An accordion menu opens and closes itself immediately when clicked, instead of just remaining open normally.
Some links that have their click event handled by Javascript suddenly ignore the event handlers, and just do nothing when clicked.
We have checked the files on our integration machine, and checked the build process many times, and we deploy the correct version of the files each time.
Where else could we check to fix this issue?
Any and all suggestions are welcome !
Thanks.
Thanks everyone !
We use Cassette for bundling our scripts, and as it turns out, I didn't notice that when we deploy, the cassette obtains one the the javascript files using a url.
That url pointed to a script we no longer use, and that was the cause for all of the weird bugs.
Thanks again.

Categories

Resources