2017-02-23 17 views
0

reactjsとwebpackを使用してWebサイトを作成しましたが、特定の機能のサポートを表示するためにmodernizrを使用していますが、IE 8以降ではサポートしていませんブラウザ。問題はウェブサイトをロードするときにwebpackと反応して失敗するということです。 私の質問は、どのように私はメッセージを表示できますか?反応負荷の前にそれを示す方法はありますか?あるいは、そのメッセージのためだけに動作させる方法がありますか?はIE 8を表示できず、サポートメッセージが表示されません

助けてくれてありがとう!

答えて

3

IE8で条件付きコメントを使用して特殊なCSSを読み込んでHTMLを印刷することができます。

http://www.quirksmode.org/css/condcom.html

例:

<!--[if lte IE 8]> 
<p class="unsupported-ie">This page is not supported for IE8 and lower versions of IE.</p> 
<![endif]--> 

そして、あなたは<head>でさえ負荷CSSができます。

<!--[if lte IE 8]> 
<link media="all" rel="stylesheet" href="/unsupported-ie.css" /> 
<![endif]--> 
+0

+「GTEすなわち9」および/またはそれがさえないように、条件付きのコメントを「IEません」でアプリケーションJSが含まダウンロードする必要があります。 – pawel

+0

thatsは実際に良いpreetey、他のブラウザbtwのためのこのようなソリューションはありますか? IEは私の主な問題ですが、具体的にはIE Xを言っていない状態を作る方法はありますか? –

+0

Internet Explorer 10以降では、条件付きコメントは標準モードでサポートされなくなりました。機能検出機能を使用して、標準モードの詳細については、「ドキュメントの互換性の定義」を参照してください。しかし、バージョン9までIEのための問題なしでそれを使用することができます。 –

0

これを確認してください、私はブラウザ&を識別するために、単純なJavaスクリプトを使用しているそのversion.Aのポップアップメッセージが表示され、適切なメッセージが表示されます。以下は ahead-進んでから、ユーザは、単純なHTMLページです: -

<!DOCTYPE html> 
<html> 
<head> 
    <style> 
       .modal { 
      display: none; /* Hidden by default */ 
      position: fixed; /* Stay in place */ 
      z-index: 1; /* Sit on top */ 
      padding-top: 100px; /* Location of the box */ 
      left: 0; 
      top: 0; 
      width: 100%; /* Full width */ 
      height: 100%; /* Full height */ 
      overflow: auto; /* Enable scroll if needed */ 
      background-color: rgb(0,0,0); /* Fallback color */ 
      background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ 
     } 

     /* Modal Content */ 
     .modal-content { 
      background-color: #fefefe; 
      margin: auto; 
      padding: 20px; 
      border: 1px solid #888; 
      width: 80%; 
     } 

     /* The Close Button */ 
      .close { 
       color: #aaaaaa; 
       float: right; 
       font-size: 28px; 
       font-weight: bold; 
       } 

      .close:hover, 
      .close:focus { 
       color: #000; 
       text-decoration: none; 
       cursor: pointer; 
      } 
    </style> 
</head> 
<body onload="IEValidationMessage();"> 

    <!-- this is the DIV used for showing message box --> 
    <div id="myModal" class="modal"> 
     <div id="closeBtn" class="modal-content"> 
      <span class="close">&times;</span> 
      <div id="divMessagebody"></div> 
     </div> 
    </div> 

    <script> 
     // When the user clicks on <span> (x), close the modal 
     var modal = document.getElementById('myModal'); 
     var span = document.getElementById("closeBtn"); 
      span.onclick = function() { 
      modal.style.display = "none"; 
     } 
     // When the user clicks anywhere outside of the modal, close it 
      window.onclick = function (event) { 
      if (event.target == modal) { 
      modal.style.display = "none"; 
      } 
     } 
     function IEValidationMessage() { 
      modal.style.display = "block"; 
      if (document.documentMode < 9) { 
       document.getElementById("divMessagebody").innerHTML = "Please Use IE 9 or Above.)"; 
      } 
      else { 
      document.getElementById("divMessagebody").innerHTML = "congrats Site is compatible in this IE version "; 
     } 
     if (document.documentMode ==undefined) { 
      document.getElementById("divMessagebody").innerHTML = "Please use IE9 or higher only. "; 
     } 
    } 

    </script> 

    </body> 

関連する問題