Menu
We can do a project for navigator all informations.Example:
[code]
function get_info(){
var nav_name=navigator.appName;
var nav_version=navigator.appVersion;
document.write (nav_name+nav_version);}
I don’t complete the code but in project we can found all function for browser informations + screen informations.
We can do a project for navigator all informations.Example:
<i>
</i>function get_info(){
var nav_name=navigator.appName;
var nav_version=navigator.appVersion;
document.write (nav_name+nav_version);}
I don't complete the code but in project we can found all function for browser informations.[/QUOTE]
Most of the time browsers do spoof (by default or following the user's option ... )[/QUOTE]I'm sure you misspoke, since browsers rarely spoof, and none of the a-grade browsers spoof by default.
[CODE]navigator.sayswho=(function(){
var N= navigator.appName,ua= navigator.userAgent,
M= ua.match(/(opera|chrome|safari|firefox|msie)/? *(.?d+(.d+)*)/i);
if(M && (tem=ua.match(/version/(.?d+(.d+)?)/i)) !=null) M[2]= tem[1];
M= M? [M[1],M[2]]: [N+' '+navigator.appVersion,'-?'];
M.push(navigator.platform)
return M.join(' ');
})()[/CODE]
I'm sure you misspoke, since browsers rarely spoof, and none of the a-grade browsers spoof by default.[/QUOTE]
Can somebody create a cookie script with navigator options?Help.[/QUOTE]
Let's put it in another way. [I]Why[/I] do you need to find the browsers' navigator properties? How could this help your site? Which is your final aim, after all?[/QUOTE]
Safari identifies as "Mozilla/5.0 ( Macintosh; U; PPC Mac OS X; ) AppleWebKit/412 (KHTML, like Gecko) Safari/412"[/QUOTE]Exactly, which means you can uniquely identify Safari.
IE identifies as "Mozilla"[/quote]IE identifies itself as "Mozilla/4.0 (compatible; [b]MSIE 7.0[/b]; Windows NT 5.1; Media Center PC 3.0; .NET CLR 1.0.3705; .NET CLR 2.0.50727)", which means you can uniquely identify IE 7. You can also uniquely identify IE 6.
Opera (old versions) identifies as "IE"[/quote]Older versions of Opera don't matter. The only browsers we care about are the a-grade browsers. And the latest version of Opera identifies itself as "Opera/9.52 (Windows NT 5.1; U; en)", which means you can uniquely identify Opera.
Chrome identifies as "Konqueror / Safari / OmniWeb 4.5+"[/quote]Chrome identifies itself as "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.30 Safari/525.13", which means you can uniquely identify Chrome.
They are obliged sometimes to do that because they know that a lot of javascript coders use sniffing codes to detect the browsers in order to create crossbrowser workarounds[/quote]If you're actually claiming that browser vendors try to obfuscate the user agent strings to discourage browser detection, then you're simply wrong. You have no evidence and no reason to make such a baseless claim.
For instance, as a new comer, Chrome is obliged now to spoof the most compatible (with him) known browsers in order to bypass the sniffing codes[/quote]Chrome uniquely identifies itself as Chrome. No spoofing is happening.
To find out the real browser, the version... you have to write endless code lines searching for all kinds of properties or strings, and not always with succes.[/quote]Plain wrong. It takes very, [i]very[/i] little code, with 100% success. There's no a-grade browser we can't uniquely detect.
Plain wrong. It takes very, [i]very[/i] little code, with 100% success. There's no a-grade browser we can't uniquely detect.[/QUOTE]
Older versions of Opera don't matter. The only browsers we care about are the a-grade browsers. And the latest version of Opera identifies itself as "Opera/9.52 (Windows NT 5.1; U; en)", which means you can uniquely identify Opera.
[/QUOTE]
Most of the time, not all of the time, and not with 100% success because it's impossible to know which browser is spoofing and which isn't.[/QUOTE]I think the particular quote I responded to was talking about whether we could identify each browser from the user agent string... which we can. What you said is still correct, but I suppose our discussion was a bit ambiguous with all the quoting.
The latest version of Opera dynamically selects between THREE different useragents by default based on which of the three that the program's authors decided should be used at any given moment.[/QUOTE]Really? I browsed to microsoft.com with Opera. If ever there was a site worthy of spoofing IE, that would be it. But the user agent string was still the same.
The standard definition for where the browser name and version are in the useragent is that they are supposed to come at the front of the string exactly as that one of the three Opera useragents does. That one clearly identifies the browser as Opera version 9.52. The IE useragents for the various IE versions clearly identify the browser as Mozilla (the code name for Netscape) version 4[/quote]Whether the unique identifier comes at the beginning, middle or end of the user agent string, it's still there, and we can uniquely detect all the a-grade browsers. You're inflating minor annoyances, but there's no real problem.
Do you have a test page, or some Opera white-paper, that confirms what you said?[/QUOTE]
Kor (since its a pile on):
sometimes browser sniffing is better than object detection.
for example: selectElement.add, xmlHttpRequest in IE7, and setting CSS props.
[/QUOTE]
<i>
</i>try {
selectElement.add(newOption,null);//full DOM
}
catch (e) {
selectElement.add(newOption,selectElement.length);//IE
}
<i>
</i>if (window.XMLHttpRequest){//DOM full compatible +IE7
...
}
else if(window.ActiveXObject){//IE <7
...
}
<i>
</i>var isIE=/*@cc_on!@*/false;//IE detector
if(isIE){ // IE
}
else{ // rest of
}
People like Jeff Mott tend to code in different ways for different browsers [I]from the beginning[/I].[/QUOTE]You have no idea how I code. All you have are baseless assumptions that you pass off as fact. But your assumptions are wrong.
By short: identifying the browser [I]is my last concern and my last option[/I] when coding. And I try rather to find a crossbrowser method than to use different methods for different browsers.[/QUOTE]As do I. There were originally only two claims in this and the other thread that I tried to clarify before the threads spiraled out of control. In the other thread, felgall said browser sniffing is pointless and serves no usable purpose, which isn't true. Even you, Kor, have admitted that some situations require it. Those situations may be rare, but they exist. The other claim was from this thread where you said browsers spoof most of the time, which also isn't true. None of the a-grade browsers spoof by default, and the vast majority of users don't choose to do so... most wouldn't even know what browser spoofing means.
It was introduced in Opera 8 seeThat switching isn't quite so "default" as your post implied. By default, Opera doesn't spoof anything, so the user must still choose to spoof.http://www.opera.com/docs/changelogs/windows/800/
Search that document for references to the ua.ini file (which is what controls which of the three useragents to use for which site).[/QUOTE]
As you can see, I don't say that we don't need to detect the browsers sometimes. I say that we [I]don't need to detect the browsers on using their navigator's properties[/I]. Sniffer codes (detectors based on the navigator object) are not accurate, [I]this[/I] is what I will say it again and again, despite the [B]Jeff Mott[/B]'s weird opinion.[/QUOTE]
That switching isn't quite so "default" as your post implied. By default, Opera doesn't spoof anything, so the user must still choose to spoof.[/QUOTE]
I am still waiting for someone to show me a valid situation involving JavaScript where a browser detect is required and there isn't an alternative way to write the code to get rid of it. [/QUOTE]Are you serious?! I gave you one in the other thread. That's twice now that you've forgotten all about it.
... the inaccurate browser sensing ...[/quote]I've said it before, but apparently I need to say it again: every a-grade browser clearly and uniquely identifies itself, and spoofing is very rare. No matter how you twist things, there's no way around that fact.
...than there is in using tables for layout in HTML[/quote]And arbitrarily associating this with tables isn't even a valid argument.
... until they finally try to do something that can't be done with their approach and they are forced to use the better way in order to get what they want to work.[/quote]I gave you an example in the other thread where browser sniffing is needed, and others here (even Kor) have described situations where browser sniffing is needed. So as it turns out, it's [i]your[/i] approach that finally can't do something.
As for your example in the other thread - when I looked at that page in Firefox 3 the simplest fix I could see to get browsers to treat the JavaScript consistently the way it worked there would be to delete the JavaScript.[/quote]That's not a solution. That's a sure way to get the client calling you, wondering why the page doesn't look and work the way the designs and specs called for.
That's not a solution. That's a sure way to get the client calling you, wondering why the page doesn't look and work the way the designs and specs called for.[/QUOTE]
<i>
</i>var sx=window.sidebar.indexOf ("xpconnect");
if (sx==+1){
document.cookie="nav"+"="+escape ("MozilaFirefox');}
if (ActiveX){
document.cookie="nav"+"="+escape ("InternetExplorer');}
0.1.9 — BETA 5.19