AJAX-Tips Tutorials
AJAX-TipsHow to Handle Long Running Script
Warnings regarding long running scripts while developing an Ajax based application are just normal for developers. Browsers will warn developers that they are making a command or function that could take a long time to be processed by the specific browser.
Of course, you can discard the message but you have already been warned: continuing with the script could slow down the application.
Good thing the current browsers are smart enough to warn you about this so that you can think twice about the command and look for ways on how you can shorten the script.
Reasons for Warnings
The warnings on long running script points out to the fact that it might take time before the actual command will happen.
The reason is plain and simple: execute it and your application will drag when it reaches the users.
However, if you take a look closely at the reasons why the specific browser says that you are working on long running scripts are different.
Apparently, each browser has their own gauge on determining why a script will be considered as “long running.”
Here’s the round-up on some of the popular browsers and their gauges on long running scripts:
- Internet Explorer: number of statements to be executed. When you reach five million statements the browser will say that you are pushing it too far and the application might not work well in the browser. The browser will count from the start of your application and when it reaches five million, it will stop. You can actually alter this by changing the registry setting on the browser. You can actually discard the warning and the statement count will restart.
. - Firefox/Mozilla: time of execution. Firefox on the other hand, doesn’t really care how many statements your online application makes. However, it will gauge how long the command will execute. If the browser will take more than 10 seconds to execute the specific function. As always, you can ignore the warning and continue coding. But be warned: 10 seconds is already a very long time for a command to execute especially on JavaScript. If you want to completely ignore the warning change the settings in about >config.
.- This gauge is also the same in Safari. However, instead of setting the limit at 10 seconds it will show the warning in 5 second setting. Disabling the warning could be found in the “Developer Menu.”
As always, Apple’s Opera is unique as it does not have any limit at all. You can run long running scripts in this browser and never encounter any warnings.
It may be good for you if you do have longer scripts but without any warning, you might be pushing the browser too far.
For this reason, it is important for developers to constantly check their online applications if they want to continue with long running scripts. Do not forget to disable them since this warning will also show up on the users’ end and this could be very annoying and even threatening to the appeal of your users.
Sponsored Links
