Skip to content

AbdelrahmanAthamneh/is-ua-browser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a lightweight library built on top of ua-parser-js that provides an instant method to determine whether a request came from a client using a browser.

How to Use

  1. Import the default export function.
  2. Pass the User-Agent string (from the http-headers of the request) to the function.
  3. The function will return a boolean indicating whether the User-Agent corresponds to a browser.

Example:

const isBrowser = require("is-ua-browser");

const userAgent = req.headers["user-agent"];
const isRequestFromBrowser = isBrowser(userAgent);

console.log(isRequestFromBrowser); // true or fase

Frequently Asked Questions (FAQ)

  • Q: If a client sent a request using a mobile browser app, would it work? A: Yes! This library detects any browser, including those on mobile devices (e.g., Chrome Mobile, Safari Mobile).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published