Is there a way to load my JavaScript into a page that will make it load faster?
What's the best way to load Javascript into a page to optimize performance?
javascript;optimization;performance
There are a few things you can do:Load the HTML and CSS before the javascript. This gives the browser everything it needs to lay out the page and render it. This gives the user the impression that the page is snappy. Place script tags or blocks as close to the closing body tag as possible.Consider using a CDN. If you are using any of the popular libraries like JQuery many companies (e.g. google, yahoo) operate free CDNs that you can use to load the libraries.Load code fron an external file instead of an embedded script. This gives the browser the opportunity to cache the JS content and not have to load it at all. Successive page loads will be faster.Turn on zip compression on the web server.Yahoo has a great page of suggestions that can help reduce page load times.