user410989
user410989

Reputation:

How to get the current user-agent?

Is there a quick and general way to display the current user-agent of your browser locally (without visiting a webpage like whatsmyuseragent.com)?

Upvotes: 3

Views: 3327

Answers (2)

sloth
sloth

Reputation: 101142

You could use netcat.

Listen on a local port:

nc -l -p 8000

Then navigate to:

127.0.0.1:8000

and netcat will spit it all out:

dkson@mymachine ~% nc -l -p 8000
GET / HTTP/1.1
Host: 127.0.0.1:8000
User-Agent: Links (2.3pre1; Linux 2.6.36-tuxonice-r1 i686; 80x24)
Accept: */*
Accept-Encoding: gzip,deflate,bzip2
Accept-Charset: us-ascii, ISO-8859-1, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-8859-10, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16, windows-1250, windows-1251, windows-1252, windows-1256, windows-1257, cp437, cp737, cp850, cp852, cp866, x-cp866-u, x-mac, x-mac-ce, x-kam-cs, koi8-r, koi8-u, koi8-ru, TCVN-5712, VISCII, utf-8
Accept-Language: en,*;q=0.1
Connection: keep-alive

This will also work for browsers that don't have javascript enabled.

Upvotes: 3

Vivek Goel
Vivek Goel

Reputation: 24160

In browser address bar fire this

javascript:alert(navigator.userAgent);

Upvotes: 5

Related Questions