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 401561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:02:43+00:00 2026-05-12T17:02:43+00:00

How would I server side detect if the user of the webpage is a

  • 0

How would I server side detect if the user of the webpage is a browser?

The reason for detecting this is, that I’m storing statistics about visited pages and I don’t want to store any statistics when the user is a crawler. So I’m not trying to detect which browser vendor. I only want a boolean answer, is the user a browser.

I assume the answer is connected with the user-agent header, but the numerous possibly values is too overwhelming for me to figure out.
How can I detect it? A 90% solution where I only detect the most Top5 popular browser would be good enough.

I’m using C# ASP.Net, but I guess most solutions in other languages and frameworks could be translated.

  • 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-05-12T17:02:43+00:00Added an answer on May 12, 2026 at 5:02 pm

    This code is by no means exhaustive, but gives you a basic founding in PHP. I can’t guarantee a few won’t slip through the net, but this should catch most browsers and ignore most bots.

    <?php
    // Regular expression to match common browsers
    $browserlist = '/(opera|aol|msie|firefox|chrome|konqueror|safari|netscape|navigator|mosaic|lynx|amaya|omniweb|avant|camino|flock|seamonkey|mozilla|gecko)+/i';
    
    // Test for browsers
    if (preg_match($browserlist, $_SERVER['HTTP_USER_AGENT'])) {
        // ...is a browser
    } else {
        // ...is not a browser
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to provide end-user scripting (that would run server-side) in an application. I've
Can anyone recommend a good server-side PDF generation tool that would work in a
I'm about to write server side aplication(most probably it would be PHP but JAVA
Here is my question, Would it be possible, knowing that classic asp support server-side
I would like to detect (on the server side) which requests are from bots.
I'm interested to know how can I detect (at the server side ) that
I would like to know how threads are handled on the server side using
Which amongst these would be well suited for a scalable server side TCP socket
In SQL Server would a varbinary(16) be the most efficient way of storing an
I hope you'll forgive me for thinking that configuring a DNS server would be

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.