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 5 of 5
  1. #1
    New Coder
    Join Date
    Nov 2006
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need Sun Solaris platform sniffer

    Hey ya'll,
    I'm looking for a web sniffer that detects someone coming in from a Sun Solaris platform. There are billyonz of sniffers for Mac/Windows/Linux, but we've got a client on Sun with specific needs. Does anyone have a solution?

    Thanks,
    Mark

  • #2
    Regular Coder
    Join Date
    May 2005
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try:
    Code:
    if(navigator.userAgent.test(/solaris/i))alert('Solaris Detected');
    you could also use the navigator.platform property, but I'm not sure what string solaris would return. My guess would be "Solaris" or "Sun Solaris" (which are the platform strings usually found in the userAgent string...)
    Last edited by VortexCortex; 11-10-2006 at 11:26 PM. Reason: I remembered the navigator.platform property -- I always just check userAgent server side then send the correct page to the client.

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Javascript has no reliable way of identifying any operating system whatsoever as it has to rely on what the browser tells it and the browser may not recognise the operating system or may have been configured to lie (it is after all a user configurable field so if I want my browser to report my operating system as "pink polkadot" then that is what the browser identifies my operating system as.

    JScript can at least identify that the browser is some version of Internet Explorer and that the platform is some version of Windows because that is the only client side environment that runs JScript in place of Javascript.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    Regular Coder ArcticFox's Avatar
    Join Date
    Jan 2004
    Location
    Vostok Station, AQ
    Posts
    602
    Thanks
    35
    Thanked 3 Times in 3 Posts
    Well show us an example, there, Spanky...
    <div> - putting your mind in a box since 1997

  • #5
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    navigator.platform may contain one of the values "Sun", "SunOS", "Solaris", or unfortunately, "Unix" or "X11" or "Java" in any capitalisation as a sign of a Solaris system. Same goes for navigator.userAgent.

    Not all browsers, nor all setttings, nor all proxies, will allow any of this to actually reach the web server, so JavaScript is about as reliable as server side methods at detecting this. Which doesn't mean much...
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    Posting Permissions

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