Hi!
I’d like to request support for detecting headless browsers.
For example, Chrome running in headless mode may expose a user agent like this:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/143.0.7499.4 Safari/537.36
At the moment, it would be useful to have a simple way to detect this through the gem, for example:
This could return true when the user agent contains known headless browser identifiers such as HeadlessChrome.
Possible use cases:
- Detecting automated/headless traffic
- Adjusting behavior for browser automation tools
- Improving analytics or request classification
- Handling bots or test environments differently
Example expected behavior:
browser = Browser.new(
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/143.0.7499.4 Safari/537.36"
)
browser.chrome? # true
browser.headless? # true
Would you be open to adding a headless? method, or something similar, to detect this kind of browser?
Thanks!
Hi!
I’d like to request support for detecting headless browsers.
For example, Chrome running in headless mode may expose a user agent like this:
At the moment, it would be useful to have a simple way to detect this through the gem, for example:
This could return
truewhen the user agent contains known headless browser identifiers such asHeadlessChrome.Possible use cases:
Example expected behavior:
Would you be open to adding a
headless?method, or something similar, to detect this kind of browser?Thanks!