July 15, 2010
Will a page taking 2-3 mins to render cause a javascript 'taking too long' warning
Question by bcm
I’m using the jQuery document ready method – $(function()
If the page takes too long to render (say 2mins+), will this be the reason for the page throwing a javascript taking too long to execute error/warning?
Answer by Igor Zevaka
No. $(function(){})
will get called once the DOM is loaded – i.e. it doesn’t keep running throughout the load process. Unless you are trying to do a long running synchronous task or stuck in a long loop, you shouldn’t get that error.
Have a look at the CPU utilization. If it’s high for the browser, it’s a tell tale sign that there is an infinite loop somewhere.
Answer by Starx
No the document.ready only loads after the DOM is ready (i.e after the jquery core is loaded and ready to be used), so it will not throw any error, if a page takes 2-3 mins.