Script for show message only in IE browser [duplicate]












-1















This question already has an answer here:




  • Detect if any kind of IE (MSIE) [duplicate]

    6 answers




Do you know a script for notices or warnings only for internet explorer users?



I need to show a warning only for users in this specific browser.



Please, Can you help me?










share|improve this question













marked as duplicate by Amy, devlin carnate, LGSon javascript
Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 18:57


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.




















    -1















    This question already has an answer here:




    • Detect if any kind of IE (MSIE) [duplicate]

      6 answers




    Do you know a script for notices or warnings only for internet explorer users?



    I need to show a warning only for users in this specific browser.



    Please, Can you help me?










    share|improve this question













    marked as duplicate by Amy, devlin carnate, LGSon javascript
    Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

    StackExchange.ready(function() {
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function() {
    $hover.showInfoMessage('', {
    messageElement: $msg.clone().show(),
    transient: false,
    position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
    dismissable: false,
    relativeToBody: true
    });
    },
    function() {
    StackExchange.helpers.removeMessages();
    }
    );
    });
    });
    Nov 21 '18 at 18:57


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















      -1












      -1








      -1








      This question already has an answer here:




      • Detect if any kind of IE (MSIE) [duplicate]

        6 answers




      Do you know a script for notices or warnings only for internet explorer users?



      I need to show a warning only for users in this specific browser.



      Please, Can you help me?










      share|improve this question














      This question already has an answer here:




      • Detect if any kind of IE (MSIE) [duplicate]

        6 answers




      Do you know a script for notices or warnings only for internet explorer users?



      I need to show a warning only for users in this specific browser.



      Please, Can you help me?





      This question already has an answer here:




      • Detect if any kind of IE (MSIE) [duplicate]

        6 answers








      javascript






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 18:46









      En Código WPEn Código WP

      11




      11




      marked as duplicate by Amy, devlin carnate, LGSon javascript
      Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Nov 21 '18 at 18:57


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






      marked as duplicate by Amy, devlin carnate, LGSon javascript
      Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Nov 21 '18 at 18:57


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          1 Answer
          1






          active

          oldest

          votes


















          0














          I had to do this problem a while back. I ended up using javascript since support for conditional comments was dropped: https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/compatibility/hh801214(v=vs.85)



          My solution ended up looking like this:



          <style>
          #ie-banner {
          display: none;
          /* other styling */
          }
          </style>

          <div id="ie-banner">
          <div id="ie-message">
          <h5>INCOMPATIBLE BROWSER</h5>
          </div>
          </div>

          <script>
          function isOldIE(userAgent) {
          var msie = userAgent.indexOf('MSIE');
          if (msie > 0) {
          // IE 10 or older
          return true;
          }
          // other browser, IE 11, or Edge
          return false;
          }
          if (isOldIE(navigator.userAgent)) {
          var ieWarning = document.getElementById('ie-banner');
          ieWarning.setAttribute('style', 'display: block;');
          // drop off my react app below
          // var root = document.getElementById('root');
          // document.body.removeChild(root);
          }
          </script>


          Note that I remove the child like that and use older DOM apis because more standards methods simply don't work on IE... big surprise.



          If you only care about IE9 and down, then I probably would just use conditional comments. Straight from the link above:



          <html>
          <!--[if IE]>
          This content is ignored in IE10 and other browsers.
          In older versions of IE it renders as part of the page.
          <![endif]-->
          </html>





          share|improve this answer























          • But I want to show an message in Explorer Totally. No versions. I don´t understand your code in my case
            – En Código WP
            Nov 21 '18 at 19:24




















          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I had to do this problem a while back. I ended up using javascript since support for conditional comments was dropped: https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/compatibility/hh801214(v=vs.85)



          My solution ended up looking like this:



          <style>
          #ie-banner {
          display: none;
          /* other styling */
          }
          </style>

          <div id="ie-banner">
          <div id="ie-message">
          <h5>INCOMPATIBLE BROWSER</h5>
          </div>
          </div>

          <script>
          function isOldIE(userAgent) {
          var msie = userAgent.indexOf('MSIE');
          if (msie > 0) {
          // IE 10 or older
          return true;
          }
          // other browser, IE 11, or Edge
          return false;
          }
          if (isOldIE(navigator.userAgent)) {
          var ieWarning = document.getElementById('ie-banner');
          ieWarning.setAttribute('style', 'display: block;');
          // drop off my react app below
          // var root = document.getElementById('root');
          // document.body.removeChild(root);
          }
          </script>


          Note that I remove the child like that and use older DOM apis because more standards methods simply don't work on IE... big surprise.



          If you only care about IE9 and down, then I probably would just use conditional comments. Straight from the link above:



          <html>
          <!--[if IE]>
          This content is ignored in IE10 and other browsers.
          In older versions of IE it renders as part of the page.
          <![endif]-->
          </html>





          share|improve this answer























          • But I want to show an message in Explorer Totally. No versions. I don´t understand your code in my case
            – En Código WP
            Nov 21 '18 at 19:24


















          0














          I had to do this problem a while back. I ended up using javascript since support for conditional comments was dropped: https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/compatibility/hh801214(v=vs.85)



          My solution ended up looking like this:



          <style>
          #ie-banner {
          display: none;
          /* other styling */
          }
          </style>

          <div id="ie-banner">
          <div id="ie-message">
          <h5>INCOMPATIBLE BROWSER</h5>
          </div>
          </div>

          <script>
          function isOldIE(userAgent) {
          var msie = userAgent.indexOf('MSIE');
          if (msie > 0) {
          // IE 10 or older
          return true;
          }
          // other browser, IE 11, or Edge
          return false;
          }
          if (isOldIE(navigator.userAgent)) {
          var ieWarning = document.getElementById('ie-banner');
          ieWarning.setAttribute('style', 'display: block;');
          // drop off my react app below
          // var root = document.getElementById('root');
          // document.body.removeChild(root);
          }
          </script>


          Note that I remove the child like that and use older DOM apis because more standards methods simply don't work on IE... big surprise.



          If you only care about IE9 and down, then I probably would just use conditional comments. Straight from the link above:



          <html>
          <!--[if IE]>
          This content is ignored in IE10 and other browsers.
          In older versions of IE it renders as part of the page.
          <![endif]-->
          </html>





          share|improve this answer























          • But I want to show an message in Explorer Totally. No versions. I don´t understand your code in my case
            – En Código WP
            Nov 21 '18 at 19:24
















          0












          0








          0






          I had to do this problem a while back. I ended up using javascript since support for conditional comments was dropped: https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/compatibility/hh801214(v=vs.85)



          My solution ended up looking like this:



          <style>
          #ie-banner {
          display: none;
          /* other styling */
          }
          </style>

          <div id="ie-banner">
          <div id="ie-message">
          <h5>INCOMPATIBLE BROWSER</h5>
          </div>
          </div>

          <script>
          function isOldIE(userAgent) {
          var msie = userAgent.indexOf('MSIE');
          if (msie > 0) {
          // IE 10 or older
          return true;
          }
          // other browser, IE 11, or Edge
          return false;
          }
          if (isOldIE(navigator.userAgent)) {
          var ieWarning = document.getElementById('ie-banner');
          ieWarning.setAttribute('style', 'display: block;');
          // drop off my react app below
          // var root = document.getElementById('root');
          // document.body.removeChild(root);
          }
          </script>


          Note that I remove the child like that and use older DOM apis because more standards methods simply don't work on IE... big surprise.



          If you only care about IE9 and down, then I probably would just use conditional comments. Straight from the link above:



          <html>
          <!--[if IE]>
          This content is ignored in IE10 and other browsers.
          In older versions of IE it renders as part of the page.
          <![endif]-->
          </html>





          share|improve this answer














          I had to do this problem a while back. I ended up using javascript since support for conditional comments was dropped: https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/compatibility/hh801214(v=vs.85)



          My solution ended up looking like this:



          <style>
          #ie-banner {
          display: none;
          /* other styling */
          }
          </style>

          <div id="ie-banner">
          <div id="ie-message">
          <h5>INCOMPATIBLE BROWSER</h5>
          </div>
          </div>

          <script>
          function isOldIE(userAgent) {
          var msie = userAgent.indexOf('MSIE');
          if (msie > 0) {
          // IE 10 or older
          return true;
          }
          // other browser, IE 11, or Edge
          return false;
          }
          if (isOldIE(navigator.userAgent)) {
          var ieWarning = document.getElementById('ie-banner');
          ieWarning.setAttribute('style', 'display: block;');
          // drop off my react app below
          // var root = document.getElementById('root');
          // document.body.removeChild(root);
          }
          </script>


          Note that I remove the child like that and use older DOM apis because more standards methods simply don't work on IE... big surprise.



          If you only care about IE9 and down, then I probably would just use conditional comments. Straight from the link above:



          <html>
          <!--[if IE]>
          This content is ignored in IE10 and other browsers.
          In older versions of IE it renders as part of the page.
          <![endif]-->
          </html>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 21 '18 at 19:00

























          answered Nov 21 '18 at 18:55









          Nick BradyNick Brady

          1,9951328




          1,9951328












          • But I want to show an message in Explorer Totally. No versions. I don´t understand your code in my case
            – En Código WP
            Nov 21 '18 at 19:24




















          • But I want to show an message in Explorer Totally. No versions. I don´t understand your code in my case
            – En Código WP
            Nov 21 '18 at 19:24


















          But I want to show an message in Explorer Totally. No versions. I don´t understand your code in my case
          – En Código WP
          Nov 21 '18 at 19:24






          But I want to show an message in Explorer Totally. No versions. I don´t understand your code in my case
          – En Código WP
          Nov 21 '18 at 19:24





          Popular posts from this blog

          404 Error Contact Form 7 ajax form submitting

          How to know if a Active Directory user can login interactively

          Refactoring coordinates for Minecraft Pi buildings written in Python