473,725 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Showing a message to IE 5+ users (yes, the browser detection question again)

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.userA gent

If ((ua.indexOf('m sie') != -1) &&
(ua.indexOf('op era') == -1) &&
(ua.indexOf('we btv') == -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.ActiveX Object &&
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

Sep 24 '06 #1
22 2299
ASM
pe**********@gm ail.com a écrit :
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 :)
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('ht tp://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$ script !
hidden to other browsers with /* ... */

--
ASM
Sep 25 '06 #3
Hi ASM,
var IE = false; /*@cc_on IE = true; @*/
/*@cc_on IE = true; @*/
detect all IEs even IE Mac
@cc_on ... @
is code in exclusive M$ script !
hidden to other browsers with /* ... */
This is very cool. What does @cc_on ... @ mean? @ is some special
thing? Do those letters cc_on stand for something meaningful?

It successfully detects IE 4, IE 5, IE 5.5, IE 6 on XP and IE 5 on OSX.
It also leaves the IE var false for Opera 8.5, Opera 9, Firefox 1.5 on
XP and Opera 9, Safari 1.3, Safari 2, Firefox 1.0, Firefox 1.5 on OS X.

Do you know if this will continue to work in IE 7?

Thank you,
Peter

Sep 25 '06 #4
pe**********@gm ail.com said the following on 9/25/2006 1:02 AM:
Hi ASM,
>var IE = false; /*@cc_on IE = true; @*/
> /*@cc_on IE = true; @*/
detect all IEs even IE Mac
@cc_on ... @
is code in exclusive M$ script !
hidden to other browsers with /* ... */

This is very cool. What does @cc_on ... @ mean? @ is some special
thing? Do those letters cc_on stand for something meaningful?
Conditional Comment
It successfully detects IE 4, IE 5, IE 5.5, IE 6 on XP and IE 5 on OSX.
It also leaves the IE var false for Opera 8.5, Opera 9, Firefox 1.5 on
XP and Opera 9, Safari 1.3, Safari 2, Firefox 1.0, Firefox 1.5 on OS X.

Do you know if this will continue to work in IE 7?
Yes, Conditional Comments still work in IE 7.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Sep 25 '06 #5
ASM
pe**********@gm ail.com a écrit :
Hi ASM,
Hi peter,
>var IE = false; /*@cc_on IE = true; @*/
> /*@cc_on IE = true; @*/
detect all IEs even IE Mac
@cc_on ... @
is code in exclusive M$ script !
hidden to other browsers with /* ... */

This is very cool. What does @cc_on ... @ mean? @ is some special
thing? Do those letters cc_on stand for something meaningful?
@cc_on starts Jscript language (Jscript statement)
It successfully detects IE 4, IE 5, IE 5.5, IE 6 on XP and IE 5 on OSX.
It also leaves the IE var false for Opera 8.5, Opera 9, Firefox 1.5 on
XP and Opera 9, Safari 1.3, Safari 2, Firefox 1.0, Firefox 1.5 on OS X.

Do you know if this will continue to work in IE 7?
No reason it will not.
because, as I said, there you speak Jscript (M$ javascript) unknown by
other browsers.

ask to google : @cc_on

http://ns7.webmasters.com/caspdoc/ht..._statement.htm
<http://msdn.microsoft. com/library/default.asp?url =/library/en-us/script56/html/1e9b3876-3d38-4fd8-8596-1bbfe2330aa9.as p>

--
ASM
Sep 25 '06 #6
ASM said the following on 9/25/2006 7:48 PM:
pe**********@gm ail.com a écrit :
>Hi ASM,

Hi peter,
>>var IE = false; /*@cc_on IE = true; @*/
>> /*@cc_on IE = true; @*/
detect all IEs even IE Mac
@cc_on ... @
is code in exclusive M$ script !
hidden to other browsers with /* ... */

This is very cool. What does @cc_on ... @ mean? @ is some special
thing? Do those letters cc_on stand for something meaningful?

@cc_on starts Jscript language (Jscript statement)
No, it doesn't. To quote your own resource:

<quote>
The @cc_on statement activates conditional compilation in the scripting
engine.
</quote>

It does not start JScript language.

<snip>
http://ns7.webmasters.com/caspdoc/ht..._statement.htm
--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Sep 26 '06 #7
ASM
Randy Webb a écrit :
ASM said the following on 9/25/2006 7:48 PM:
>@cc_on starts Jscript language (Jscript statement)

No, it doesn't. To quote your own resource:

<quote>
The @cc_on statement activates conditional compilation in the scripting
engine.
</quote>

It does not start JScript language.
No it starts french ?
<snip>
>http://ns7.webmasters.com/caspdoc/ht..._statement.htm

Sep 26 '06 #8
ASM said the following on 9/25/2006 10:44 PM:
Randy Webb a écrit :
>ASM said the following on 9/25/2006 7:48 PM:
>>@cc_on starts Jscript language (Jscript statement)

No, it doesn't. To quote your own resource:

<quote>
The @cc_on statement activates conditional compilation in the
scripting engine.
</quote>

It does not start JScript language.

No it starts french ?
Something like that, but it sure as heck doesn't "starts Jscript language".

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Sep 26 '06 #9
Randy Webb wrote:
ASM said the following on 9/25/2006 10:44 PM:
Seems to me that wherever dates are inserted into news messages that
the timeszone should be included. If other posters insert similar
unqualified data, I expect the times as represented in text to be out
of sync with the actual flow of events.

Perhaps you could add a timezone? That might also give a hint on how
to interpret the date where the day date value is less than 13 - an ISO
format would reduce confusion further.
--
Rob

Sep 26 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
10071
by: Szar | last post by:
JS noob. I've seen plenty of browser detection scripts but they all seem to be slightly different and don't really fit my needs. I have various places where if the browser is IE I'd like to display else . For example, if a browser is IE I want to use this CSS file otherwise use a different one and if it's IE make this cell x pixels high else make it y pixels high. I'm sure this is easy, please excuse my stupidity. Steve.
16
2227
by: Jonas Smithson | last post by:
I'm going to say something now that may seem to completely contradict a previous post of mine, in which I basically said that taking a "who cares" attitude about certain browsers (because of their non-standard CSS rendering) makes no sense. Well, you have to draw the line *somewhere*... and contradictory or not, I've decided that I've suffered with Netscape 4 for long enough. Coding workarounds for its brain-dead CSS rendering has...
5
1513
by: chris | last post by:
i have a set od radio buttons what i wanty to do is when one particular button is selected bring up an additional text box for additional information how would i do this
17
2555
by: lawrence | last post by:
How is it possible that the question "How do I detect which browser the user has" is missing from this FAQ: http://www.faqts.com/knowledge_base/index.phtml/fid/125 and is only here on this with a link to old information that suggests use of "navigator": http://developer.irt.org/script/43.htm
8
4548
by: R. Smits | last post by:
I've have got this script, the only thing I want to be changed is the first part. It has to detect IE version 6 instead of just "Microsoft Internet Explorer". Can somebody help me out? I tried "Microsoft Internet Explorer 6" but that doesn't work. <SCRIPT LANGUAGE="Javascript"> <!-- bName = navigator.appName; if (bName =="Microsoft Internet Explorer") { document.write('<link media="screen" rel="STYLESHEET" type="text/css"
8
1682
by: Jimnbigd | last post by:
What is the recommended code to test browser type, for conditional processing in Javascript? I have seen tests for "document.all". I have seen tests for the actual browser name, or substrings in the browser name. What do you all recommend? Thanks...Jim...
4
2574
by: trpost | last post by:
I am looking for a script using javascript to pull browser information including, browser type and version, OS info, plugins (flash, acrobat, media player, etc), java version, etc. that will work on IE/Firefox. I am looking for detalis similar to what is available at: http://www.webreference.com/tools/browser/_browserhawk.html Thanks!
1
5579
by: Grimm | last post by:
I am developing an internalk inteface that integrates alot of seperate tools into one interface. The current version uses one Iframe inside a div layer for positioning. Currently the seperate web tools do not have the ability to stay active. As you switch from tool to tool the previous information is lost unless you use a Back button. I need to place multiple div layers with I frames in them that can be shown or hidden based on selection. The...
20
3188
by: luqman | last post by:
If user login with the login control in ASP.Net 2005 and then just close the browser and then open the browser again, the login status shows, User still Login? Any idea, how to Logout the User when the User click on the Close Button of Browser ? I am using Sql Membership Provider for security. Best Regards,
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9111
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8096
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.