What's in your <head>? Part 4—<script>
For once, the sun is shining here in the UK, the sky is blue, and people everywhere are smiling and walking hand-in-hand through the parks and avenues. All in all, it᾿s a good day to look at the
<script> tags in The Great Discontent᾿s
The <script> tags in the <head> section
<script> element, like
<title> but unlike
<link>, has an opening tag and a closing tag, and stuff either in the middle or in its attributes. Here are TGD᾿s
The second one, I guess, is some kind of error-handling script for Typekit. I guess
Typekit.load() is a JS function in the kld3xsa.js file referenced above.
The final script tag loads the modernizr.js file, which you can find at the Modernizr website. According to the website, Modernizr is...
So, presumably, this enables TGD to appear ‘normal’ on older and crankier browsers.Skip to navigation
<script> tags in the <body>
<head> section isn᾿t the only place where
<script> tags appear. There are several peppered throughout the HTML, some of them embedded and some of them external. The reason for this might be that external scripts in the <head> section need to load before the whole page will render on screen. If you add too many
<script> tags in the head, the page could take a long time to load and turn off users with a short attention span (i.e. everyone).
So, that᾿s it for the
<head>. The four most important tags,
<script> fulfil a number of functions: declaring the character set, dealing with different browsers and viewports, giving information to users and search engines, and linking to style sheets and script files. The
<head> isn᾿t exactly the sexiest aspect of a HTML document, but like filing paperwork or raking leaves off the lawn, it᾿s an important fact of life that we all have to learn to love.
Next up: TGD᾿s responsive images. Whoop whoop!Skip to navigation