如何在noscript中添加链接标记标记其显示 [英] How to add link tag inside noscript tag its showing
问题描述
我在标签内添加了如下标签:
< noscript>
< link type =text / css =stylesheethref =$ {staticFilesUrl} /css/noscript-overrule.css/>
< / noscript>
但在Firefox启用javascript时,我看到类似这样的内容
< noscript>
& lt; link type =text / css =stylesheethref =/ static / snsbank / css / noscript-overrule.css/& gt;
< / noscript>
事件我试图将样式标记放入noscript标记中仍然保留在Firefox中我得到以下结果 p>
< noscript>
& lt;风格& gt; #whiteBox {width:30%; &安培; LT /风格&安培; GT;
< / noscript>
任何人都可以告诉我如何避免这种情况?
您在评论中提问:如果我只想在禁用javascript的情况下使用一个css文件,那我该怎么办?
至少有两种方法(可能更多):
-
有一个默认样式表,总是加载。然后,如果启用了javascript,请在
头
中使用< script>
标签在默认情况下覆盖样式。 -
如果你只是改变了一些东西,有一个样式表并且在
body of
NoJavascriptEnabled
,您可以在javascript未启用时用于定位这些少数样式,然后使用javascript来删除 该类如果启用了javascript。
I added tag inside the tag as following
<noscript>
<link type="text/css" rel="stylesheet" href="${staticFilesUrl}/css/noscript-overrule.css" />
</noscript>
but in firefox when the javascript is enabled I see something like this
<noscript>
< link type="text/css" rel="stylesheet" href="/static/snsbank/css/noscript-overrule.css" />
</noscript>
event I tried to put style tag inside the noscript tag still in firefox I got the following result
<noscript>
< style > #whiteBox{ width:30%; </style>
</noscript>
can anyone tell me how can I avoid this?
You ask in a comment: "if I want to use one css file only if javascript is disabled then what should I do?"
Two ways at least (probably more):
Have a default stylesheet that is for without javascript that always loads. Then, if javascript is enabled, use a
<script>
tag in thehead
to load a different stylesheet after the default to override the styles.If you just have a few things that change, have one style sheet and have a class on your
body
ofNoJavascriptEnabled
that you use to target those few styles when javascript is not enabled, and then use javascript to remove that class if javascript is enabled.
这篇关于如何在noscript中添加链接标记标记其显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!