SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy help needed with sniffer script

    I'm trying to get together a sniffer that will isolate...

    (Window 98 && Explorer (5.5 or less), but my attempts so far aren't working.

    I'm testing on a mac, but the actions that I give to Win98/IE<=5.5 are kicking in on my Mac too.

    This is what I have...

    Code:
    if((navigator.userAgent.indexOf("MSIE") != -1) && ((navigator.userAgent.indexOf("Win98")) || (navigator.userAgent.indexOf("Windows 98")) != -1) && (parseFloat(navigator.appVersion) < 5.5)) {
      alert("Windows 98 IE5.5")
    } else {
    alert("Mac")
    }
    (the alerts are just being used temporarily to find out if the sniffer is working)

    I'm almost certainly making a mess of all the (s, )s, |s and &s.

    Some help would be appreciated, before I go insane.

    TIA
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  2. #2
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This made sense to me straight away ... but i guess if you're not used to it it could give you a real headache.

    I hope this works - i've not tested it at all.

    Code:
    if ((navigator.userAgent.indexOf("MSIE")!=-1)&&(((navigator.userAgent.indexOf("Win98")!=-1)||(navigator.userAgent.indexOf("Windows 98")!=-1))&&(parseFloat(navigator.appVersion)<=5.5)))
    
    // Expanded ( i bet you needed this - lol
    
    if 
    (
     (navigator.userAgent.indexOf("MSIE") != -1)
     && 
     (
      (
       (navigator.userAgent.indexOf("Win98") != -1)
       ||
       (navigator.userAgent.indexOf("Windows 98") != -1)
      )
      && 
      (parseFloat(navigator.appVersion) <= 5.5)
     )
    )
    let me know - especially since i don't think this is much different from what you had - if this works

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  3. #3
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks flawless.

    Seems to have done the trick.

    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  4. #4
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    * won't say ANYTHING about DW here *

    lol - only joking mate

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---


Bookmarks

Posting Permissions

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