向IE 5+用户显示消息(是的,再次显示浏览器检测问题) [英] Showing a message to IE 5+ users (yes, the browser detection question again)

查看:52
本文介绍了向IE 5+用户显示消息(是的,再次显示浏览器检测问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我想向Internet Explorer客户端显示一条消息

包装它们以获取Firefox。是的他们可能喜欢Internet Explorer但是

这是我的网站:)

http://www.explorerdestroyer.com/ 使用navigator.userAgent


If((ua.indexOf(''msie'')! = -1)&&

(ua.indexOf(''opera'')== -1)&&

(ua.indexOf(' 'webtv'')== -1)){

/ *向IE用户显示消息* /

}


我确定有更好的方法来进行这种一般检测。我隐约地看到了一个巨大的长篇文章,如果有条件的话测试了很多不同的对象,以确定一个非常具体的IE版本。我认为

Richard Cornford写道。我只花了一个小时(字面意思!)搜索档案,但不幸的是找不到这篇文章。它可能是以下几行,但非常延伸。


if(window.ActiveXObject&&

document.all){

/ *向IE用户显示消息* /

}


我希望我收到了书签帖子因为我一般很好奇

了解更多关于不同版本的Internet Explorer以及

功能的区别。


我想要检测IE 5和更新版本。任何建议或任何人都知道

关于这篇文章?

谢谢你,

彼得

Hi,

I would like to display a message to Internet Explorer clients to
encorage them to get Firefox. Yes they may like Internet Explorer but
it is my site :)

http://www.explorerdestroyer.com/ uses navigator.userAgent

If ((ua.indexOf(''msie'') != -1) &&
(ua.indexOf(''opera'') == -1) &&
(ua.indexOf(''webtv'') == -1)) {
/* show message to IE users*/
}

I''m sure there is a better way to do this general detection. I vaguely
remember seeing a post with a huge long if conditional testing many
different objects to determine a very specific version of IE. I think
Richard Cornford wrote it. I just spent an hour (literally!) searching
the archives and couldn''t find the post unfortunately. It may have been
along the lines of the following but very extended.

if (window.ActiveXObject &&
document.all) {
/* show message to IE users*/
}

I wish I had bookmarked that post because I am generally curious to
learn more about different versions of Internet Explorer and which
features distinguish it.

I would like to detect IE 5 and newer. Any suggestions or anyone know
about this post?

Thank you,
Peter

推荐答案

虽然不是来自档案.. IEBlog:

http://blogs.msdn.com/ie/archive/2006/09/20/763891.aspx
http://blogs.msdn .com / ie / archive / 2005/04/27 / 412813.aspx
http://msdn.microsoft.com/workshop/a...tuseragent.asp
http://msdn.microsoft.com/workshop/a...rdetection.asp

Not from archive though .. IEBlog:

http://blogs.msdn.com/ie/archive/2006/09/20/763891.aspx
http://blogs.msdn.com/ie/archive/2005/04/27/412813.aspx
http://msdn.microsoft.com/workshop/a...tuseragent.asp
http://msdn.microsoft.com/workshop/a...rdetection.asp


pe ****** **** @ gmai l.com aécrit:
pe**********@gmail.com a écrit :




我想向Internet Explorer显示一条消息客户将

包装起来以获取Firefox。是的他们可能喜欢Internet Explorer但是

这是我的网站:)
Hi,

I would like to display a message to Internet Explorer clients to
encorage them to get Firefox. Yes they may like Internet Explorer but
it is my site :)



在标题'javascript:


var IE = false; / * @ cc_on IE = true; @ * /

if(IE&&

确认(''小心你不能使用正确的浏览器!\ n''+

''你不想尝试充分利用网络吗?\ n''+

''FireFox适合你''))

window.open(''http://www.mozilla.com/firefox/'');

或在页面中:


< div style =" display:none" id = IE>

< h1>小心你没有使用正确的浏览器!< / h1>

< h2>你不试试如何充分利用网络?< / h2>

< p>< a href =" http://www.mozilla.com/firefox/" target =" _blank">

FireFox适合你< / a>< / p>

< / div>

< script type =" text / javascript">

var IE = false; / * @ cc_on IE = true; @ * /

if(IE)document.all [''IE'']。style.display =''block'';

< / script>

nota:

/ * @ cc_on IE = true; @ * /

检测所有IE甚至IE Mac

@cc_on ... @

是独家M中的代码

in header''s javascript :

var IE = false; /*@cc_on IE = true; @*/
if(IE &&
confirm(''Be careful you don''t use correct browser !\n''+
''Won''t you try to get the most out of the Web ?\n''+
''FireFox is for you''))
window.open(''http://www.mozilla.com/firefox/'');
or in the page :

<div style="display:none" id=IE>
<h1>Be careful you don''t use correct browser !</h1>
<h2>Won''t you try to get the most out of the Web ?</h2>
<p><a href="http://www.mozilla.com/firefox/" target="_blank">
FireFox is for you</a></p>
</div>
<script type="text/javascript">
var IE = false; /*@cc_on IE = true; @*/
if(IE) document.all[''IE''].style.display=''block'';
</script>
nota :
/*@cc_on IE = true; @*/
detect all IEs even IE Mac
@cc_on ... @
is code in exclusive M


脚本!

隐藏到其他浏览器/ * ... * /


-

ASM
script !
hidden to other browsers with /* ... */

--
ASM


这篇关于向IE 5+用户显示消息(是的,再次显示浏览器检测问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆