【发布时间】:2012-09-28 11:50:54
【问题描述】:
Dolphin 浏览器和默认 Android 浏览器正在读取我页面顶部的 <noscript> 部分,即使在这些浏览器中打开了 javascript。这会导致这些页面的内容不被呈现。
在标题中,我链接到一个 css 样式表,当浏览器中关闭 javascript 时,该样式表将页面上 div 内的任何内容设置为无。它通过驻留在非脚本元素中来做到这一点,因此只有在没有 javascript 时才会读取样式表。
这适用于我测试的所有桌面/笔记本电脑浏览器(未在我无权访问的 mac 上测试)。它适用于带有 Firefox 和 Opera 的 Android。我只有 cyanongenmod 7,所以我没有 Google Chrome。
但是,对于 Dolphin 和默认的 Android 浏览器,它们会读取位于 noscript 部分的 css 样式表,并且几乎整个页面/站点都不会在这些浏览器中呈现。
我已经通过从头部删除样式表链接来证明这是正在发生的事情,并且页面在这些浏览器中正确呈现。
有没有办法让这些浏览器尊重 head 部分的 noscript 标签?
更新:这是使用 HTML5 - 头部中的 noscript 是允许的:http://www.w3.org/TR/html5/the-noscript-element.html#the-noscript-element
<!DOCTYPE html>
<html>
<head>
<noscript>
<link href="${facesContext.externalContext.requestContextPath}/css/no_javascript.css" rel="stylesheet" type="text/css" />
<!-- this link is being read even if javascript in enabled in dolphin -->
</noscript>
</head>
<body>
<noscript>
stuff in this noscript element works correctly
</noscript>
<div class="no_javascript_disapear">
page full of stuff not being rendered because
dolphin browser is not respecting the noscript
tags in the head.
</div>
</body>
</html>
// css in the noscript tag:
.no_javascript_disapear {display:none;}
【问题讨论】:
标签: html css noscript dolphin-browser