How Do You Externalize Javascripts And CSS Files For Faster Downloads?
JavaScript is used to add interactivity to an HTML page. Cascading Style Sheets (CSS) are used to create presentational parts of a web page such as colors or layouts. The two can be used in the HTML or removed from the page (externalized). The externalized files are then linked to the page. After the page has downloaded the first time, the JavaScript and CSS files are in the browser cache. All further downloads from your site will be faster, because only the HTML will be downloaded. Here is how to do it. Instead of saving your CSS as part of the HTML document, save it in a separate file with a .css file extension. Store that CSS file in a logical place in your site structure. Some sites have more than one style sheet and store them all in a directory called “css.” Link your HTML page to the CSS file using either a link element or an @import element. A link element would be placed in the HTML document head and would look something like this image. The link element gives the location of