Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Dec 2002
    Location
    Central New York
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Opera Browser Detect... What Gives?

    Hrm. Okay...

    <script language="javascript" type="text/javascript">
    <!--
    var browser=navigator.appName;
    document.write("You\'re using: ", browser);
    //-->
    </script>

    results "You're using: Microsoft Internet Explorer" with MSIE.
    results "You're using: Netscape" with NN.
    but, results "You're using: Microsoft Internet Explorer" with Opera.

    What's up with that?
    Timothy Boronczyk

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #3
    Regular Coder Skyzyx's Avatar
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It all depends on what you have Opera set to identify as. Set it to identify as Mozilla/5.0 or as Opera, it that info will change.

    If you read my other post, it'll detect Opera regardless of what it identifies as.

    Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    this script includes detectin for O5,O6 and O7

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    when you have built your script post a link and people who use opera (like me) will see if your script can detect opera.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #6
    Regular Coder Skyzyx's Avatar
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts
    nice sniffer, brothercake!

    I don't suppose you have a userAgent value for Konqueror and k-meleon, do you? I've almost got everything nailed down for my sniffer I've been working on for a while.

    It'd be a huge help!

    Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is knoqueoror 3 on red hat 8.0

    Mozilla/5.0 (compatible; Konqueror/3; Linux)

    you can always rely on the "Konqueror/X.X" arrangement, and you also have "navigator.vendor" which only Konqueror has (but of course is all versions, not just 3+). I find 2.2+ a useable group, but only 3.0+ really counts as a "good browser"

    I don't have k-meleon here; i'll check it at work tomorrow.

  • #8
    New Coder
    Join Date
    Dec 2002
    Location
    Central New York
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts
    so for knoqueoror the detection routine would be if (navigator.vendor!="undefined")?

    here's what I've got in regards to the opera:


    <script language="javascript">
    if (typeof window.opera!="undefined") {
    document.write("You're using Opera");
    } else
    if (navigator.appName=="Netscape") {
    document.write("You're using Netscape.");
    } else
    if (navigator.appName=="Microsoft Internet Explorer") {
    document.write("You're using MS Internet Explorer");
    }

    </script>
    Timothy Boronczyk

  • #9
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by bluephoenix
    here's what I've got in regards to the opera:

    The thing with Opera is that 5,6 and 7 are all completely different in terms of behaviour and support; treating them the same is no more useful than treating ie4 and ie6 the same.

    Originally posted by bluephoenix
    ... Konqueror detection ..

    What I do is this:

    Code:
    if(typeof navigator.vendor!="undefined"){
    	if (navigator.vendor=="KDE"){
    		var thisKDE=agt;
    		var splitKDE=thisKDE.split("konqueror/");
    		var aKDE=splitKDE[1].split("; ");
    		var KDEn=parseFloat(aKDE[0]);
    		if(KDEn>2.2){
    			kde=1;
    			ns6=1;
    			exclude=0;
    			}
    		}
    	}
    The navigator.vendor tells me it's konqueror, which I use as a broad-knife, in order that I know the UA string format I'm dealing with. Then I split that up so that version >=2.2 return true for (kde) while lower versions return false. For ease, I let it return true for (ns6) as well; just a personal shortcut which is arguably counter productive in some situations.




    btw - Skyzyx - here's a k-meleon UA string. It's from 0.6 which isn't the latest version, I don't think, but it also returns its gecko version.

    Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.5) Gecko/20011011

    I've never found the need to identify gecko browser individually, apart from a switch that differentiates between Netscape builds and others.
    Last edited by brothercake; 01-14-2003 at 01:30 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •