I\'m writing an AJAX web app that uses Comet/Long Polling to keep the web page up to date, and I noticed in Chrome, it treats the page as if it\'s always loading (icon for t
I'm not sure about jQuery or Ajax, but I had a similar problem with inserting snippets into Ace Editor with the Snippet Manager. When inserting code into the editor right when the page was loading the page would seem to never load - the tab icon would spin forever. .setTimeout()
only worked very inconsistently. It would work when the page loaded very quickly, but not when the page loaded more slowly. That might be because I wasn't wrapping anything in $(document).ready()
- I was only calling my code at the end of the document body.
Here's a no-jQuery solution I found to my forever-spinning tab icon problem:
var tillPageLoaded = setInterval(function() {
if( document.readyState === 'complete' ) {
clearInterval(tillPageLoaded);
// load whatever
}
}, 5);
In my case, // load whatever
was:
ace.config.loadModule('ace/ext/language_tools', function () {
myEditorInstance.insertSnippet( 'some string' );
});