This article mainly introduces how long a common browser will prompt "the script runs for too long". If you need it, refer to the current web, the speed of user access is not just the speed of File Download. When all files are downloaded from the server, rendering starts from the browser to the time when the user can respond, this time will still consume a long time. At the same time, javascript will become more and more complex due to the complexity of interaction. The script running time is reflected on the interface, which means the response to user input and click is too slow, even the browser prompts that the script times out.
This document does not intend to explain how to avoid such timeout and javascript optimization skills. Simply put, we will talk about the endurance limitations of various browsers. The following is the data summarized by Nicholas C. Zakas.
Chrome: the prompt that the execution time exceeds 8 seconds.
IE: a prompt is displayed when you execute more than 5 million Javascript statements.
Firefox: a prompt is displayed when the task is executed for more than 10 seconds.
Safari: a prompt is displayed when the execution lasts for more than 5 seconds.
Opera: No prompt will appear no matter how long it takes to run.
Generally, it is recommended that the script run time be less than 100 ms for users. if the process is too slow, you can consider some workarounds, such as prompting users with loading.