Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8097313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:43:05+00:00 2026-06-05T21:43:05+00:00

I need to detect IE7 (and IE6) using the user agent string: I have

  • 0

I need to detect IE7 (and IE6) using the user agent string:

I have made the following regex:

navigator.userAgent.match(/MSIE [67]\./)

However, IE9 in quirks mode also matches the regex with the following user agent:

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 7.1; Trident/5.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C)

I could make two regexes:

navigator.userAgent.match(/MSIE [67]\./) !== null 
  && navigator.userAgent.match(/Trident\/5\.0/) === null

Is there a way I can combine them into one?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:43:08+00:00Added an answer on June 5, 2026 at 9:43 pm

    Assuming the Trident part always comes after the MSIE part, you can use a lookahead:

    /MSIE [67]\.(?!.*Trident[5]\.0)/
    

    I’m not familiar with user agents strings, but I’m guessing that maybe IE10 in quirks mode could have a Trident version > 5, so you could change it to:

    /MSIE [67]\.(?!.*Trident[1-9])/
    

    UPDATE: second regex edited to include earlier versions of Trident too, e.g. Trident/4.0 in IE8, as well as potential later versions >= 10.

    UPDATE2: Cleaned up RegEx’s to be valid in javascript.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: generically parsing String to date Following situation: I need to detect if
I need to detect all the red pixels in an image using Java. What
I need to detect and eval the Javascript code contained in a string. The
I need to detect IE6 in order to work around the lack of position:fixed.
i need to detect the strength of the shake. I have to move some
I need to detect is my input string a file name or a directory
I need to detect if a user is scrolled to the bottom of a
I need to detect when a program crashes or is not running using python
I have a flash app and I need to detect whether the streaming of
I need to detect whether my Makefile is running under valgrind (indirectly, using valgrind

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.