2011-08-06 4 views
1

これはすべてのブラウザで安全ですか?これは、jsがオフのときにユーザーを別の場所にリダイレクトする方法です。このトリックはすべてのブラウザで安全に実行できますか?

<noscript> 
    <meta http-equiv="refresh" content="0;url=http://site.com/nojs"> 
</noscript 
+5

をあなたがこの記事を見てすることがあります:http://stackoverflow.com/questions/2270478/有効な方法を追加するためにnoscriptの - のために - 折り返し - リダイレクト –

+2

[動作するものをビルド](http://icant.co.uk/articles/pragmatic-progressive-enhancement/) – Quentin

+0

十分に安全です。 – nobody

答えて

1

クラスを<html>要素に追加することをお勧めします。このトリックをie-xクラスと組み合わせることができます。例えば

<!doctype html> 
<!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]--> 
<!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]--> 
<!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]--> 
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--> 

<head> 
<!-- some meta tags ---> 
<script> 
(function(doc) { 
    doc.className = doc.className.replace(/(^|\b)no\-js(\b|$)/, 'js'); 
}(document.documentElement)); 
</script> 
<!-- other script tags should be before </body> --> 

あなたがそれについて読むことができます:html5boilerplatehere

関連する問題