O'Reilly logo

ASP.NET Site Performance Secrets by Matt Perdeck

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Approach 4: Loading Javascript without blocking

The idea behind this approach is to load all (or almost all) script files without blocking rendering of the page. That puts the rendered page sooner in front of the visitor.

There are a couple of ways to achieve this, each trading off more work for a better visitor experience:

  • Moving all<script> tags to the end of the page
  • Separating user interface code and render code
  • Introducing page loading indicator
  • Loading code in parallel with the page

Let's go through each of them.

Moving all <script> tags to the end of the page

On a basic level, loading JavaScript code without blocking page rendering is really easy to accomplish—simply take your script tags out of the head of the page, and move them to the end ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required