Blog

Cross Browser defer Attribute

shutterstock_234378844
BLOG / Web Development

Cross Browser defer Attribute

The boolean defer attribute on script elements allows the external JavaScript file to run when the DOM is loaded, without delaying page load first.

Browser Support

defer attribute is already supported by all major browser so it should be really easy to get it working cross browser.

Code Example

You can use defer attribute like this:

<script defer src="somefile.js"></script>

More Information

More information can be found here.