Vladislav Rastrusny
Vladislav Rastrusny

Reputation: 29965

jQuery: synchronously update progress bar as html page loads?

I have a script that sends emails (subscriptions). Processing takes long enough. The script outputs a log (of what is successfully sent to the moment) to browser.

I would like it to show progress bar also. How do I do that? There is no AJAX calls, page loads synchronously. I thought may be I should just output <script>...</script> tags every X email sendings to move progress bar, but I'm not sure it's cross-browser compliant. Is that a standard, that browser should execute Javascript as soon as it encounters some in the page body?

Upvotes: 1

Views: 1367

Answers (1)

Herman Schaaf
Herman Schaaf

Reputation: 48435

Yes, your idea is used very often and should work in most browsers - the standard is that javascript must be executed synchronously, unless specifically told not to by the async attribute.

So you can just put in a script tag every now and again to update the status bar. Gmail uses the same technique, as far as I know.

Upvotes: 4

Related Questions