浏览器如何从HTML页面检测嵌入的Web内容? [英] How does browser detect embedded web content from a HTML page?

查看:461
本文介绍了浏览器如何从HTML页面检测嵌入的Web内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦浏览器获得主html页面,它如何知道哪些嵌入式内容应该再次从Web服务器请求,哪些只是外部链接?它是基于标签的类型,例如?

Once a browser gets the main html page, how does it know which are the embedded content should be request again from web server, and which are only external links? Is it based on type of tags, e.g ?

如果是这样,有人可以给我一些这些标签的参考吗?

If so, could someone give me a reference of what these tags are?

谢谢。

推荐答案

HTML5规范定义了元素类别嵌入式内容

The HTML5 spec defines the element category "Embedded content":


嵌入内容是将其他资源导入文档的内容,或插入文档的其他词汇表中的内容。

Embedded content is content that imports another resource into the document, or content from another vocabulary that is inserted into the document.

它列出了以下元素:


  • audio

  • canvas

  • embed

  • iframe

  • img

  • math

  • object

  • svg

  • video

  • audio
  • canvas
  • embed
  • iframe
  • img
  • math
  • object
  • svg
  • video

元素如 link script (均在元数据类别)还可以引用用户代理(浏览器,屏幕阅读器......)可以自由链接或包含的其他资源或做任何他们想做的事情。例如,像Firefox或Chromium这样的浏览器将(默认情况下)加载并应用在链接元素中链接的CSS,该元素具有 rel value = stylesheet 。像Lynx或w3m这样的浏览器不会这样做。他们只是忽略了那个链接。

Elements like link or script (both in Metadata category) can also refer to other ressources that user-agents (browsers, screen-readers, …) are free to link to or include or do whatever they want to do with it. For example, browsers like Firefox or Chromium will (by default) load and "apply" CSS that is linked within the link element, that has the rel value = stylesheet. Browsers like Lynx or w3m won't do that. They simply ignore that link.

对于链接,HTML5 状态哪些链接类型是指向要使用的资源的链接扩充当前文档,通常由用户代理自动处理:

For link, HTML5 states which link types "are links to resources that are to be used to augment the current document, generally automatically processed by the user agent":


可以使用<$ c $创建两类链接c> link 元素:指向外部资源的链接和超链接。 链接类型部分定义特定链接类型是外部资源还是超链接。

Two categories of links can be created using the link element: Links to external resources and hyperlinks. The link types section defines whether a particular link type is an external resource or a hyperlink.






也许还要考虑风格属性(对于内联CSS),可能包含背景图像 url


Maybe also consider the style attribute (for inline CSS), which could include a background-image url.

这篇关于浏览器如何从HTML页面检测嵌入的Web内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆