如何创建弹出消息“可能无法在Internet Explorer中工作”

时间:2013-09-04 23:17:33

标签: jquery internet-explorer popup

我不确定这是否曾经完成过。有没有办法创建弹出消息,可能是jQuery,出现在您的网站上,“注意!此网站可能无法在Internet Explorer版本中使用。我们建议使用Firefox,谷歌浏览器,Opera等。抱歉给您带来的不便!“

更好!是否可以在用户在Internet Explorer中打开网站时弹出此通知?

我甚至不知道从哪里开始这样的项目! 非常感谢帮助!!

3 个答案:

答案 0 :(得分:1)

试试这个:http://jsfiddle.net/meub/6TsnP/

HTML:

<!--[if IE]>
    <style type="text/css">
        .unsupported-browser {display:block;}
    </style>
<![endif]-->
<div class="unsupported-browser">
    <div class="container">
         <h2>Please note that this site doesn't support Internet Explorer.</h2>

        <p>We recommend using <a href="https://chrome.google.com">Google Chrome</a> or <a href="https://mozilla.org/firefox/">Firefox</a>.</p>
    </div>
</div>

CSS:

.unsupported-browser {
    /* Uncomment this for production use
    display:none;*/
    padding: 15px 0;
    color: #211E14;
    background-color: #FAE692;
    background-repeat: repeat-x;
    border-bottom: 1px solid #B3A569;
    position: fixed;
    top: 0px;
    left:0px;
    width: 100%;
}
.container {
    padding:40px;
    margin: 0px auto;
    max-width: 960px;
}

答案 1 :(得分:0)

我能想到的最简单的方式:

<!--[if IE]>
<script src="yourscript.js"></script>
<![endif]-->

将弹出代码放在“yourscript.js”文件中,并将上述内容写在HTML代码上,以便仅在IE中查看页面时加载外部文件。 (你当然可以在条件语句中放置一个内联脚本,但我发现IE用户应该等待一些额外的毫秒来获取外部加载请求XD - 我的意思是?)

编辑:我讨厌IE!

答案 2 :(得分:0)

将此添加到您的页面。

<script type="text/javascript>
    if(navigator.appVersion.indexOf("MSIE")!=-1)
    alert("Notice! This website etc.");
</script>

应该做的伎俩。但我认为这是一个糟糕的主意。