在noscript元素中加载资源 [英] Loading assets in a noscript element
问题描述
我希望标准行为是不在< noscript>
元素中加载任何资产,在FF和Chrome中快速粗略测试证明这是案件。但是,在启用脚本时是否会加载< noscript>
元素中的资源(例如图像)?
I expect the standard behavior would be to not load any assets in a <noscript>
element, and a quick cursory test in FF and Chrome proves this to be the case. However, are there any situations where assets (e.g. an image) in a <noscript>
element, would be loaded when scripts are enabled?
推荐答案
根据 W3规格 :
According to W3 specifications:
NOSCRIPT元素允许作者提供备用
a脚本未执行时的内容。在以下情况下,NOSCRIPT元素的内容应仅由脚本感知用户代理呈现
:
用户代理配置为不评估脚本。用户代理
不支持文档前面的SCRIPT元素
调用的脚本语言。不支持客户端
脚本的用户代理必须呈现此元素的内容。
The NOSCRIPT element allows authors to provide alternate content when a script is not executed. The content of a NOSCRIPT element should only be rendered by a script-aware user agent in the following cases: The user agent is configured not to evaluate scripts. The user agent doesn't support a scripting language invoked by a SCRIPT element earlier in the document. User agents that do not support client-side scripts must render this element's contents.
所以我想就像你的测试一样证明:当客户支持< script> <时,
< noscript>
部分内的元素将不会被渲染(即也会下载) / code> elements。
So I guess just like your testing proved: elements inside a <noscript>
section will not be rendered (i.e. downloaded as well) at all when the client supports <script>
elements.
我还在我的一个页面上测试了这个,它在< noscript> <中使用了一个图像/ code>部分,Chrome,FF,Opera或IE确实没有对下载图片感兴趣。
I also just tested this on a page of mine that uses an image inside its <noscript>
part and neither Chrome, FF, Opera or the IE did show any interest in downloading the image.
这篇关于在noscript元素中加载资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!