Twitter 在他们的标签中有这个:
<noscript>
<meta http-equiv=refresh content="0; URL=/?_twitter_noscript=1" />
</noscript>
body 有这个:
<noscript>
<div class="front-no-js-warn">
<h3>Twitter.com makes heavy use of JavaScript</h3>
<p>If you cannot enable it in your browser's preferences, you may have a better experience on our <a href="http://m.twitter.com">mobile site</a>.</p>
</div>
</noscript>
使用 CSS:
.front-no-js-warn{position:absolute;top:50px;
left:50%;
height:30px;
width:798px;
padding:15px 20px;
margin:0 0 0 -418px;
z-index:2;color:#ddd;
line-height:1.5;
background-color:#111;
background-color:rgba(20,20,20,.9);
-webkit-border-radius:6px;
-moz-border-radius:6px;
border-radius:6px;
}
.front-no-js-warn h3{color:#FEC632;font-weight:bold;}
.front-no-js-warn a{color:#75C6F7;}
因此,当您禁用 javascript 时,您会看到 div class="front-no-js-warn"
我的问题是重定向到 ?_twitter_noscript=1
有什么意义,我该如何实现它?我尝试做类似的事情,但它无休止地尝试重定向。
最佳答案
您应该检查索引页面中的 $_GET['_twitter_noscript=1'] (php),如果存在则显示不同的页面。
例子:
<?php
if ($_GET['_twitter_noscript']) {
echo "Display javascript-less page";
} else {
echo "noscript...meta refresh... etc etc ... /noscript";
//Rest of the page...
}
?>
关于javascript - Twitter 如何做 noscript 重定向,有什么意义?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10484408/