You are here: System » BrowserDetectPlugin

BrowserDetectPlugin

Determine Web browser, version, and platform from an HTTP user agent string

Description

This plugin leverages HTTP::BrowserDetect for wiki apps. In general your wiki apps should not depend on a specific browser. However it might be useful to distiguish the device the wiki app is running on such as tablets vs desktop vs mobile ones.

Usage

%BROWSERINFO{"<format-string>" ua="..."}%

By default the properties of the current browser are extracted. However you might use the ua="..." string to test different devices. The <format-string> might contain a variety of variables that are expanded to the properties found in the current device.

Context

Boolean browser properties - those that return 1 or 0 are flagged to the Foswiki context as well so that you can make use of them in IfStatements. Below example will generate two different whatsapp links depending on whether you are on a mobile device or not.

You type:

<a href="%IF{"context mobile"
            then="whatsapp://"
            else="https://web.whatsapp.com?"
          }%send?text=%ENCODE{"Hello World"}%">
  %JQICON{"fa-whatsapp"}% Share on !WhatsApp
</a>

You get:

Share on WhatsApp

Context settings are:

gecko webkit trident presto khtml edgehtml

windows win16 win3x win31 win32 winme win95 win98 winnt win2k winxp win2k3
winvista win7 win8 win8_0 win8_1 win10 win10_0 wince winphone winphone7
winphone7_5 winphone8 winphone10

adm android aol aol3 aol4 aol5 aol6 applecoremedia audrey avantgo avantgo
blackberry browsex chrome dalvik dsi elinks emacs epiphany firefox galeon icab

ie ie10 ie11 ie3 ie4 ie4up ie5 ie55 ie55up ie5up ie6 ie7 ie8 ie9 ie_compat_mode

edge edgelegacy

iopener ipad iphone ipod kindle kindlefire konqueror links lotusnotes lynx
mobile_safari mosaic mozilla n3ds nav2 nav3 nav4 nav45 nav45up nav4up nav6
nav6up navgold neoplanet neoplanet2 netfront netscape obigo

opera opera3 opera4 opera5 opera6 opera7

palm polaris ps3 psp pubsub realplayer realplayer_browser safari seamonkey silk
staroffice ucbrowser wap webos webtv

mac mac68k macppc macosx ios

unix sun sun4 sun5 suni86 irix irix5 irix6 hpux hpux9 hpux10 aix aix1 aix2 aix3
aix4 linux sco unixware mpras reliant dec sinix freebsd bsd

chromeos dotnet firefoxos lib mobile robot tablet webview x11

vms amiga ps3gameos pspgameos

General Properties

Property Value
browser safari
browser_string Safari
browser_version 1.0
browser_major 1
browser_minor .0
browser_beta  
browser_properties robot, robot_id, safari, webkit
device  
device_string  
user_agent Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)

Engines

engine webkit
engine_version 537.36
engine_major 537
engine_minor .36
engine_beta  
edgehtml 0
gecko 0
khtml 0
presto 0
trident 0
webkit 1

OS

Property Value
os  
os_string  
os_version  
os_major  
os_minor  
os_beta  

Browsers

Property Value
adm 0
android 0
aol 0
aol3 0
aol4 0
aol5 0
aol6 0
applecoremedia 0
audrey 0
avantgo 0
avantgo 0
blackberry 0
browsex 0
chrome 0
dalvik 0
dsi 0
edge 0
edgelegacy 0
elinks 0
emacs 0
epiphany 0
firefox 0
galeon 0
icab 0
ie 0
ie10 0
ie11 0
ie3 0
ie4 0
ie4up 0
ie5 0
ie55 0
ie55up 0
ie5up 0
ie6 0
ie7 0
ie8 0
ie9 0
ie_compat_mode 0
iopener 0
ipad 0
iphone 0
ipod 0
kindle 0
kindlefire 0
konqueror 0
links 0
lotusnotes 0
lynx 0
mobile_safari 0
mosaic 0
mozilla 0
n3ds 0
nav2 0
nav3 0
nav4 0
nav45 0
nav45up 0
nav4up 0
nav6 0
nav6up 0
navgold 0
neoplanet 0
neoplanet2 0
netfront 0
netscape 0
obigo 0
opera 0
opera3 0
opera4 0
opera5 0
opera6 0
opera7 0
palm 0
polaris 0
ps3 0
psp 0
pubsub 0
realplayer 0
realplayer_browser 0
safari 1
seamonkey 0
silk 0
staroffice 0
ucbrowser 0
wap 0
webos 0
webtv 0

Windows

Property Value
windows 0
win16 0
win3x 0
win31 0
win32 0
winme 0
win95 0
win98 0
winnt 0
win2k 0
winxp 0
win2k3 0
winvista 0
win7 0
win8 0
win8_0 0
win8_1 0
win10 0
win10_0 0
wince 0
winphone 0
winphone7 0
winphone7_5 0
winphone8 0
winphone10 0

Macs

Property Value
mac 0
mac68k 0
macppc 0
macosx 0
ios 0

Unix

Property Value
unix 0
sun 0
sun4 0
sun5 0
suni86 0
irix 0
irix5 0
irix6 0
hpux 0
hpux9 0
hpux10 0
aix 0
aix1 0
aix2 0
aix3 0
aix4 0
linux 0
sco 0
unixware 0
mpras 0
reliant 0
dec 0
sinix 0
freebsd 0
bsd 0

Devices

Property Value
amiga 0
chromeos 0
dotnet 0
firefoxos 0
lib 0
mobile 0
ps3gameos 0
pspgameos 0
tablet 0
vms 0
webview 0
windows 0
x11 0

Robots

Property Value
robot 1
robot_string ClaudeBot
robot_id unknown
robot_version 1.0
robot_major 1
robot_minor .0
robot_beta  
all_robot_ids ahrefs, altavista, apache-http-client, apple, archive-org, askjeeves, baidu, baiduspider, bingbot, bitly, curl, discordbot, embedly, facebook, facebookexternalhit, flipboard, getright, golib, google, google-adsbot, google-adsense, google-favicon, google-mobile, google-page-speed, google-plus-snippet, googlebot, googlebot-image, googlebot-mobile, googlebot-news, googlebot-video, headless-chrome, indy-library, infoseek, java, libwww-perl, linkchecker, linkedin, linkexchange, ltx71, lycos, malware, microsoft-office, mj12bot, msn, msn-mobile, nutch, nuzzel, outbrain, phplib, pinterest, pro-sitemaps, puf, quora-link-preview, qwantify, reddit, researchscan, robot, rogerbot, ruby-http-library, showyou, skype-uri-preview, slack, swiftbot, tumblr, twitter, unknown, verisign-ips-agent, vkshare, w3c-validator, wget, whatsapp, yahoo, yahoo-slurp, yandex, yandex-images

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. "Extensions Operation and Maintenance" Tab → "Install, Update or Remove extensions" Tab. Click the "Search for Extensions" button. Enter part of the extension name or description and press search. Select the desired extension(s) and click install. If an extension is already installed, it will not show up in the search results.

You can also install from the shell by running the extension installer as the web server user: (Be sure to run as the webserver user, not as root!)
cd /path/to/foswiki
perl tools/extension_installer <NameOfExtension> install

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See https://foswiki.org/Support/ManuallyInstallingExtensions for more help.

Dependencies

NameVersionDescription
HTTP::BrowserDetect>=3.0Required

Change History

27 Apr 2022 detect edge and edge/legacy
19 Oct 2020 fixed user agent initialization
20 May 2020 admins may use the ua url parameter for testing
26 Oct 2018 performance fixes; all positive boolean browser properties are added to the Foswiki "context" now
22 Oct 2018 initial release

This site is powered by FoswikiCopyright &© by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Ütopya? Send feedback
This website is using cookies. More info. That's Fine