Archive for JavaScript

Loading external JavaScript synchronously might block your page to load

A few days ago I wanted to visit zen pencils webpage. You may find some inspirational quotes wrapped in pretty cartoon art. I enjoy them both. However when I opened the link in my browser it all got stuck with header shown and nothing more loading.

Page stopped loading because my browser (Opera if you do not recognize) was waiting for some external resource to load.

Fortunately I know how to overcome this issue and easily disabled scripts on this particular page. After hitting F5 the page got loaded instantly. But I’m a pro-user and I don’t think common user could figure it out. They would just simply close the tab (perhaps entire browser), got a bit angry because they didn’t see what they wanted and leave.

While nowadays keeping page load times low is very important you surely don’t want this to happen on your site.

Read more

DOM in $(document).ready not always ready

Today I have found out that Internet Explorer 9 might fire document ready JavaScript event before document is actually ready. It took me a few swearwords to figure it out. I experienced this issue using Internet Explorer 9 and jQuery 1.8.0.

The solution is simple – in case you are using inline scripts, just put them at the bottom of your page. That’s it.

Read more