[thelist] Browser detection

Kasimir K evolt at kasimir-k.fi
Wed Nov 16 14:37:26 CST 2005

Dear List members,

I need some solid browser detection, preferably client side. And I only 
need to detect Opera - which happens to have that handy "Browser 
identification" feature...

The reason I need to identify Opera is how it interprets HTTP/1.1 13,13, 
  History Lists. [0]

I have a Flash based music player on a site[1]. When a user adds a track 
to the playlist, the player inserts the track's id at the end of session 
specific playlist file on the server. When the player needs next track, 
it calls always the same URI, and the script on the server pulls the 
next id from this FIFO playlist, reads the corresponding mp3 file, and 
returns that to the player.

While we all know that any digital music can be copied, this at least 
puts it a couple steps further for non-hacker users. There's always just 
one URI, so tracks can't be mass downloaded directly from the server, 
and there's always only one track in the cache.

To the Opera problem. When player requests a track makes this kind of 
But Opera treats repeated requests in the same way as moving in history, 
not as clicking a link. So not even my

Cache-Control: no-store, no-cache, must-revalidate
Expires: Thu, 01 Jan 1970 00:00:00 GMT

do help - Opera just picks the file from its history (not cache) and the 
request never makes it to the server.

So with Opera I can't use the same URI (I must add ?{timestamp}). But I 
want to do that with other browsers. So I must detect Opera.

How do I do that reliably? As the player requires JS, we can use that. 
But navigator.userAgent is not really safe, don't you think? Would it 
happen to have any Opera specific objects I could test for?

And really happy I would be, if somebody comes up with a way to make 
Opera ignore its history and just do the bloody request :-)


[0] http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.13
[1] http://musex.fi/midem2006/  (a quick and dirty site - please don't 
pick on anything ugly you are bound to find ;-)

More information about the thelist mailing list