How to obtain browser version in web app?

Martin Baxter mblivecode at harbourhosting.co.uk
Thu Jun 2 04:17:28 EDT 2011


On second thoughts I should have had my coffee before replying as you
are talking about a stack not an irev script and my reply is irrelevant.

In the revlet case I can't recall if there is a simple way off the top
of my head. It is possible, but awkward to get the user agent from
javascript and pass it to the revlet in its startup parameters. Not sure
if server variables are available inside the revlet itself.

Sorry for the preceding noise

Martin Baxter

On 02/06/2011 09:08, Martin Baxter wrote:
> 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