Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a question about <link> and <script> positioning #245

Merged
merged 2 commits into from
Jan 30, 2015

Conversation

phanan
Copy link

@phanan phanan commented Jan 30, 2015

Yet another question I find myself asking candidates more than often. These are rather old practices (Yahoo!'s Best Practices for Speeding Up Your Web Site article is turning nine this year) but, to my knowledge, still apply.

For the "exceptions" part, this is extracted from Google Analytics official guide:

Paste your [GA script] (unaltered, in its entirety) into every web page you want to track. Paste it immediately before the closing </head> tag.

I guess this exception applies to all tracking scripts.
Side: The question can lead to discussions about sync/async script loading.

@arthurvr
Copy link
Member

For the "exceptions" part, this is extracted from Google Analytics official guide:
Paste your [GA script] (unaltered, in its entirety) into every web page you want to track. Paste it immediately before the closing </head> tag.

I guess this exception applies to all tracking scripts.

Nah. We had various discussions about it in html5 boilerplate: h5bp/html5-boilerplate#1614. A better example would be Modernizr, which has its reasons to be in our <head>. We're planning to change that tho.

@phanan
Copy link
Author

phanan commented Jan 30, 2015

Nice discussion you guys have there. Does that render my proposed question invalid though?

@arthurvr
Copy link
Member

No, for sure not. Was just saying :)

@@ -57,6 +57,8 @@ This file contains a number of front-end interview questions that can be used wh
* Consider HTML5 as an open web platform. What are the building blocks of HTML5?
* Describe the difference between cookies, sessionStorage and localStorage.
* Describe the difference between `<script>`, `<script async>` & `<script defer>`.
* Why is it generally a good idea to position CSS `<link>`s between `<head></head>` and JS `<script>`s just before `</body>`?
* Do you know any exceptions for this rule?

This comment was marked as abuse.

This comment was marked as abuse.

@darcyclarke
Copy link
Member

👍

darcyclarke added a commit that referenced this pull request Jan 30, 2015
Added a question about <link> and <script> positioning
@darcyclarke darcyclarke merged commit 2ddecf6 into h5bp:master Jan 30, 2015
MUDev1994 pushed a commit to MUDev1994/Front-end-Developer-Interview-Questions that referenced this pull request May 26, 2023
Added a question about <link> and <script> positioning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants