Tuesday, February 12, 2013

Browser wars

I've been busy making SST movies. It's automated now, and I can produce lots, and keep them up to date. But showing them can be a nightmare. There are technical issues, but they seem to be mainly commercial or patent. So I've been producing movies in swf, flv, ogg, mp4 and it's still hard to get something that works for everyone.

But my latest frustration was kinda amusing. I thought to make with Javascript a different player for each browser. A bit of extra coding, but I've got pretty familiar with them all now. Javascript provides a navigator object which returns a appCodeName and an appName for each browser. So I thought I'll just use that to switch. Just have to find out the names they use.

I use Firefox mostly, so I checked that. appCodeName=Mozilla, as expected. appName=Netscape - not so obvious, but I know the history.

Then I tried IE. Surprise. appCodeName=Mozilla! But at least appName=Microsoft Internet Explorer.

Then I tried Chrome. Worse. appCodeName=Mozilla, appName=Netscape. And Safari the same. So I'm stymied. Navigator will even return a detailed header, but I can't see anything there I can reliably use. There's likely to be more difference between browser versions than browser brands.

Anyway I found this amusing account of the history.

Update - I think I found a solution. Go with their strength!

They don't mind using each other's names. What they won't share is a video format. The new HTML5 video tag allows you to ask whether particular formats are supported.
IE supports MP4 but not WebM or OGG
FF supports WebM and OGG but not MP4
Safari supports only MP4 and
Chrome supports all 3.
So awarding 4 points for MP4, 2 for WebM and 1 for OGG we have the  scores:
IE 4, FF 3, Safari 4 and Chrome 7.

That still leaves IE and Safari. But IE at least uses its own appName.

Actually IE is helpful in another way. They are so non-standard that they provide a metalanguage, buried in HTML comments, that allows you to write IE-only blocks of code.


  1. I've been watching my various java applets get broken massively recently as various people shut down java due to security holes, often without warning. Given I use them to promote my work, it's... not ideal. Your post has made me think "well, just go a different route" won't be entirely trouble free either.

    At the same time, walled gardens like iOS grow in power. It's a rather worrying time for coding!

  2. Replies
    1. Dan, I thought that link overstated the difficulties. I don't think IE can hold out long on WebGL. Lots of people are using JS/WebGL successfully. Three.JS is a convenience, but not essential - I don't use it.