简体   繁体   English

noscript 仅在 Internet Explorer 中显示

[英]noscript only displays in internet explorer

so on the Wordpress site I'm working on the noscript is not supposed to be shown.所以在 Wordpress 网站上,我正在研究 noscript 不应该显示。 this works properly on every browser but Internet Explorer.这适用于除 Internet Explorer 之外的所有浏览器。

making a some images appear twice.使一些图像出现两次。

this code appears also in other browsers but doesn't show:此代码也出现在其他浏览器中,但不显示:

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

with above this one the normal img getting loaded in. why does it only load in on IE11 and not on other browsers and is there any way to do something like display: none or something like that to the noscript inside my style.css file在这个上面,正常的 img 被加载了。 为什么它只在 IE11 上加载而不是在其他浏览器上加载,有没有办法对我的 style.css 文件中的 noscript 执行类似 display: none 或类似的操作

A simple way is using javascript to hide the image:一种简单的方法是使用 javascript 隐藏图像:

Add an id attribute to this image:向此图像添加 id 属性:

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

And the javascript:和 javascript:

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

Update:更新:

According www.w3shools.com the noscript tag can only contain <link>, <style>, and <meta> elements, if the noscript tag is in the head section.根据www.w3shools.com ,如果 noscript 标签位于 head 部分,则 noscript 标签只能包含<link>, <style>, and <meta>元素。

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

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