繁体   English   中英

noscript 仅在 Internet Explorer 中显示

[英]noscript only displays in internet explorer

所以在 Wordpress 网站上,我正在研究 noscript 不应该显示。 这适用于除 Internet Explorer 之外的所有浏览器。

使一些图像出现两次。

此代码也出现在其他浏览器中,但不显示:

<noscript>
     <img alt="image" src="www.---.jpg">
</noscript>

在这个上面,正常的 img 被加载了。 为什么它只在 IE11 上加载而不是在其他浏览器上加载,有没有办法对我的 style.css 文件中的 noscript 执行类似 display: none 或类似的操作

一种简单的方法是使用 javascript 隐藏图像:

向此图像添加 id 属性:

<img id="noscriptImg" alt="image" src="www.---.jpg">

和 javascript:

window.onload=function(){document.getElementById("noscriptImg").style.display="none";};

更新:

根据www.w3shools.com ,如果 noscript 标签位于 head 部分,则 noscript 标签只能包含<link>, <style>, and <meta>元素。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM