Ordenando la cabeza

19/Jul/2011 339

Muchas veces nos esforzamos en tener el código más limpio y pulcro posible, pero no nos fijamos en lo que sucede dentro del <head></head>. Es una parte vital, donde se define el comportamiento de toda la página web. Pero primero, debemos entender cómo el browser lee una página web.

Cuando un navegador comienza a parsear una página, comienza a leer desde el encabezado, claro. Si la respuesta del encabezado del content-type especifica un atributo charset, esos bytes pueden ser interpretados inmediatamente como texto utilizando el encoding determinado. Sin embargo, si una declaración charset no está presente, el browser comienza a escanear los bytes de de respuesta del cuerpo, buscando por algún marcador unicode ó algún elemento dentro del meta http-equiv que especifique el charset. Cuando lo encuentra el parser vuelve a leer el documento para asegurarse que lo anterior sea leído correctamente. Ahora, si una declaración de charset no está definido, el browser está obligado a autodetectar el encoding dependiendo del contenido, lo que puede provocar errores de caracteres o en la página misma.

Luego, son leídos el título, favicon y los estilos (<link>) los que deben estar en concordancia con el charset definido anteriormente.

Finalmente, el orden ideal propuesto por la mayoría de los navegadores modernos es el siguiente:

<doctype>
<html>
      <head>
         <meta http-equiv content-type charset>
         <title>
         <link rel="alternate" />
         <link rel="shortcut icon" />
         <link rel="stylesheet" type="text/css" />

Parece obvio, pero no muchas veces se cumple.


No incluí <script></script> intencionalmente ya que existen escuelas que dicen que es mejor incluirlos abajo del código de tu página, antes del </body>, lo que no valida en el código HTML pero acelera la carga de los elementos del DOM y deja para el final la carga de los scripts. Mejor lo dejo a criterio de cada desarrollador.

Links:

Comentarios

  1. Mobile recharge [#]

    What a beautiful blog

  2. coub.com [#]

    Great delivery. Outstanding arguments. Keep up the great effort.
    scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery

  3. HenryUnfiP [#]

    dhunt gay online dating site
    does eharmony have gay dating
    uk gay dating site

  4. http://www.iherb.com/search?kw=questbars [#]

    Pretty! This has been an extremely wonderful article.
    Thanks for providing these details. quest bars https://www.iherb.com/search?kw=quest%20bars quest bars

  5. nike off white [#]

    I precisely had to appreciate you yet again. I am not sure the things I would’ve tried in the absence of those methods shown by you relating to my topic. It was before a very intimidating concern in my opinion, but coming across a specialized avenue you managed the issue forced me to cry over fulfillment. I’m just grateful for the service and thus pray you know what an amazing job you have been undertaking educating other individuals by way of your blog. I am sure you have never come across all of us.

  6. yeezy [#]

    I and also my friends were found to be checking the nice things from your site then all of the sudden I had a horrible suspicion I never expressed respect to the website owner for those tips. All of the women are already so happy to read all of them and have very much been loving those things. I appreciate you for indeed being quite accommodating as well as for using this kind of good resources millions of individuals are really desperate to know about. My personal honest apologies for not saying thanks to you sooner.

  7. golden goose sneakers [#]

    Thanks for all your valuable labor on this site. Gloria loves setting aside time for investigation and it is simple to grasp why. My spouse and i know all relating to the compelling tactic you create priceless tips through your website and in addition strongly encourage participation from the others on this area plus our simple princess is without a doubt discovering a lot. Take pleasure in the rest of the new year. You are always carrying out a terrific job.

  8. kd13 [#]

    Needed to post you a very little word just to thank you so much yet again on your pleasant solutions you’ve contributed on this site. It has been tremendously open-handed with you to deliver unhampered exactly what a lot of folks might have supplied for an e-book to get some cash for their own end, and in particular seeing that you might well have done it if you decided. The creative ideas in addition worked to become great way to be aware that other people online have similar dreams just like my own to find out a great deal more concerning this matter. I am sure there are lots of more pleasant sessions ahead for people who find out your blog post.

  9. hermes belt [#]

    I want to show thanks to the writer just for bailing me out of this instance. As a result of searching through the internet and seeing opinions which were not productive, I was thinking my entire life was gone. Existing minus the approaches to the problems you’ve resolved by means of your main blog post is a crucial case, as well as ones which could have badly affected my career if I had not discovered the blog. Your training and kindness in controlling a lot of stuff was precious. I don’t know what I would have done if I hadn’t discovered such a stuff like this. I am able to now look ahead to my future. Thanks for your time so much for the high quality and effective help. I won’t hesitate to suggest your site to any individual who ought to have guidance about this issue.

  10. jordan shoes [#]

    I want to express thanks to the writer for rescuing me from such a setting. As a result of exploring throughout the online world and finding notions which were not beneficial, I was thinking my life was over. Living without the presence of approaches to the issues you have resolved as a result of your good guideline is a crucial case, as well as the kind which could have negatively affected my career if I had not encountered your blog. Your own talents and kindness in dealing with almost everything was valuable. I don’t know what I would’ve done if I had not come upon such a point like this. It’s possible to now look forward to my future. Thanks so much for this skilled and sensible guide. I won’t hesitate to refer your web sites to any person who should have guidelines on this situation.

  11. bitly.com [#]

    I am sure this article has touched all the internet visitors, its really really pleasant post on building up new blog.
    ps4 games https://bit.ly/3z5HwTp ps4 games

  12. zithromaxeska [#]

    z pack dosage instructions z pak strength is zithromax a strong antibiotic

  13. HenryUnfiP [#]

    gay dating site in usa hookups
    gay dating site for young
    the guy im dating seems gay

  14. stromectolforte.com [#]

    stromectol ivermectin http://stromectolforte.com/ buy ivermectin for humans uk stromectol

  15. cetirizine 10 mg [#]

    zyrtec information – http://allergyd.com

  16. target zyrtec price [#]

    zyrtec allergy 10 mg dosage – http://allergyd.com

  17. pharmaceptica.com [#]

    hydroxychlor tab https://www.pharmaceptica.com/

  18. pharmacepticacom [#]

    chloroquine vs chloroquine phosphate https://pharmaceptica.com/

  19. modafinilwarnings [#]

    modafinil over the counter modalert 100 price india

  20. ivermectin cena [#]

    General Low-down About this outcome
    https://ivermectinst.com ivermectin parasite kills list
    https://ivermectinstrom.com ivermectin drug
    https://ivermectstromect.com can humans take horse ivermectin
    https://ivermectinstrom.com ivermectina como tomar
    https://ivermectinsts.com ivermectin 12 mg

  21. modafinilgeneric [#]

    armodafinil vs modafinil modafinil generic

  22. bactrim dosage [#]

    trimethoprim sulfamethoxazole dosage https://bactrimsulfamethoxazole.com/

  23. drineecrqe [#]

    https://sotretisotretinoin.com/ how does accutane work

  24. buy ivermectin canada [#]

    how to buy ivermectin http://stromectolforte.com/ purchasing ivermectin from frontier doctors canine ivermectin for sale

  25. stromectolforte.com [#]

    ivermectin for humans over the counter http://stromectolforte.com/ stromectol uk pil stromektol

  26. modafinildrugtest [#]

    https://modafinilok.com/ how long does modafinil last

  27. bactrim for uti [#]

    is bactrim a strong antibiotic sulfamethoxazole trimethoprim

  28. provigilprescription [#]

    provigil for depression where to buy modafinil

  29. air jordan [#]

    Thank you for all of the hard work on this web page. Ellie delights in engaging in investigation and it is simple to grasp why. A number of us hear all concerning the lively method you provide valuable tricks via the web site and even boost contribution from other ones about this concern while our favorite princess is truly learning so much. Have fun with the remaining portion of the new year. You’re performing a powerful job.

  30. kawhi leonard shoes [#]

    I definitely wanted to construct a note to say thanks to you for those wonderful tips and tricks you are sharing on this website. My time intensive internet search has now been recognized with professional ideas to talk about with my two friends. I ‘d mention that most of us readers actually are very much fortunate to dwell in a wonderful site with very many brilliant people with valuable advice. I feel rather fortunate to have seen your entire webpages and look forward to many more cool minutes reading here. Thanks once more for all the details.

  31. supreme new york [#]

    My spouse and i felt quite comfortable Chris managed to deal with his preliminary research while using the precious recommendations he grabbed through your site. It is now and again perplexing just to be freely giving methods that many people could have been trying to sell. We really see we need the writer to thank for this. The specific explanations you have made, the easy blog menu, the relationships you will make it possible to create – it’s many terrific, and it’s aiding our son in addition to us reckon that that issue is thrilling, and that’s seriously serious. Thank you for everything!

  32. longchamp handbags [#]

    I needed to send you the bit of observation to finally say thanks a lot again just for the lovely basics you have documented on this site. It’s wonderfully generous of you in giving unhampered exactly what a lot of folks would have offered for an e book to help make some bucks for their own end, particularly seeing that you might well have tried it if you considered necessary. These tactics likewise served to become easy way to be aware that other individuals have the same dreams just like my own to know the truth very much more with regard to this matter. I’m sure there are millions of more pleasant situations up front for those who browse through your blog post.

  33. jordan shoes [#]

    My spouse and i were very more than happy that Raymond managed to round up his preliminary research from your ideas he obtained in your web pages. It’s not at all simplistic to simply be releasing ideas that many others have been trying to sell. We already know we now have you to give thanks to because of that. All of the explanations you’ve made, the simple blog navigation, the relationships you can aid to foster – it’s mostly amazing, and it is leading our son in addition to the family imagine that the theme is excellent, and that’s pretty pressing. Thank you for everything!

  34. air jordan [#]

    Thank you so much for giving everyone a very brilliant chance to discover important secrets from here. It’s usually so fantastic and as well , jam-packed with a great time for me personally and my office acquaintances to visit the blog at the least thrice in one week to find out the fresh guidance you will have. And of course, I’m also certainly astounded with the stunning knowledge you serve. Some 2 tips in this post are clearly the best we have all ever had.

  35. yeezy [#]

    I precisely desired to thank you so much once more. I am not sure what I might have made to happen in the absence of the actual methods discussed by you about such a problem. It was the alarming condition in my position, but coming across a professional style you handled it took me to jump over joy. I am grateful for this guidance and thus expect you find out what a powerful job you were getting into training people today by way of your web blog. Probably you’ve never got to know any of us.

  36. off white outlet [#]

    I simply wanted to compose a simple note to be able to appreciate you for those pleasant guides you are placing on this site. My particularly long internet research has at the end of the day been compensated with pleasant ideas to share with my guests. I ‘d claim that many of us visitors actually are very fortunate to exist in a very good place with very many wonderful professionals with great strategies. I feel quite lucky to have encountered the webpage and look forward to really more exciting minutes reading here. Thank you once more for all the details.

  37. modalertvsmodvigil [#]

    modafinil withdrawal provigil prescription

  38. stromectolforte.com [#]

    ivermectin for sale https://stromectolforte.com/# stromectol 3mg tablets stromectol gГ©nГ©rique

  39. GustavoVet [#]

    writing paper online
    essay helpers

CSSLab