一旦浏览器获取了主 html 页面,它如何知道哪些嵌入内容应该再次向 Web 服务器请求,哪些只是外部链接?它是否基于标签类型,例如?
如果是这样,有人可以给我引用这些标签是什么吗?
谢谢。
最佳答案
HTML5 规范定义了元素类别“Embedded content”:
Embedded content is content that imports another resource into the document, or content from another vocabulary that is inserted into the document.
它列出了以下元素:
音频
Canvas
嵌入
iframe
img
数学
对象
svg
视频
诸如 link
或 script
之类的元素(均在 Metadata category 中)也可以引用用户代理(浏览器、屏幕阅读器等)免费的其他资源链接到或包含或做任何他们想做的事情。例如,Firefox 或 Chromium 等浏览器将(默认情况下)加载并“应用”在 link
元素中链接的 CSS,该元素的 rel
值 = 样式表
。 Lynx 或 w3m 等浏览器不会这样做。他们只是忽略该链接。
对于链接
,HTML5 states哪些链接类型“是指向用于扩充当前文档的资源的链接,通常由用户代理自动处理”:
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.
也许还可以考虑 style
属性(对于内联 CSS),其中可能包含 background-image
url
。
关于browser - 浏览器如何检测 HTML 页面中嵌入的 Web 内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12320239/