How to obtain browser version in web app?

Martin Baxter mblivecode at harbourhosting.co.uk
Thu Jun 2 04:08:22 EDT 2011


Hi Kee,

You have to parse out the HTTP_USER_AGENT string yourself I think

This old test script might get you started:

<?rev
put $_SERVER["HTTP_USER_AGENT"] into tua
put offset("MSIE",tua) into tie
put offset("Safari",tua) into tmac
put offset("Opera",tua) into topera
put offset("Gecko/",tua) into tgecko

put "<p>user agent: " & tua & "</p>"
put "<p>offset of MSIE: " & tie & "</p>"
put "<p>offset of Safari: " & tmac & "</p>"
put "<p>offset of Opera: " & topera & "</p>"
put "<p>offset of Gecko: " & tgecko & "</p>"
?>

Sample output

user agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.17)
Gecko/20110420 Firefox/3.6.17

offset of MSIE: 0

offset of Safari: 0

offset of Opera: 0

offset of Gecko: 62


Probably needless to say that user agent strings aren't standardised.

Martin Baxter



On 01/06/2011 23:48, Kee Nethery wrote:
> It is possible to get any information about the browser running a web
> based livecode stack? If so, how? Didn't see anything in the
> dictionary.
> 
> For example, Safari 5.0.5 or IE 7.2 or anything like that?
> 
> Thanks, Kee Nethery





More information about the use-livecode mailing list