SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    RegExp navigator.userAgent

    Am I blind or what...
    Why is /MSIE (5\.5)|[6789]/.test(navigator.userAgent) true
    when navigator.userAgent == "Opera/7.0 (Windows 2000; U) [en]" ?


    (Can understand that it's true if Opera identifies itself as MSIE 6.0 for example, but not this)

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone got a bright idea?

    I added " && !/opera/i.test(navigator.userAgent)" because I have to check Opera browsers identifying themselves as MSIE or Mozilla/5 anyway, but the fact that /MSIE (5\.5)|[6789]/ is true is still confusing...

  3. #3
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    That's very weird, and I have no idea why it's returning true jofa! Your regex seems perfectly valid. Is there any logic before that regex that could be causing the problem?

  4. #4
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, I changed it to /MSIE\s(5\.5|[6789])/, and now it's working












    I think...


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
  •