Skip to content

语义-浏览器加载过程

浏览器加载顺序

  1. HTML下载顺序自上而下,遇到语义解释性会启用单独连接进行下载。
  2. CSS下载完毕后立即渲染到页面,下载和渲染是同步,每次渲染都会对之前的元素重新渲染。
  3. 运行脚本过程中,会停止页面元素下载。

不同浏览器之间的差异

  1. IE、Safair、Chrome等在文档流先出现的资源优先下载。
  2. FF会将脚本、样式提前下载,图像资源延迟下载。

注意

  1. 由于运行脚本过程中会停止元素下载,所以要特别注意一些内联脚本,这经常会阻塞后续下载。
  2. 为了安全起见,放在某断HTML后的脚本,执行时最好还是在domready事件中,无论哪个浏览器解析完HTML后,还并不能代表DOM可以安全操作,特别在网页复杂时。

参考资料

相关日志

Categories: 技术.

Tags: ,

Comment Feed

No Responses (yet)



Some HTML is OK

or, reply to this post via trackback.

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word