[Seaside] How to best detect browser for audio tag differences
tamackinnon at gmail.com
Mon Aug 2 23:48:16 UTC 2010
Hi guys - I've looked through suggestions for browser detection on the
list - but am unsure what the best approach is to handle the
differences between how browsers handle the audio tag in html5.
I don't need to support all browsers (and part of this is education
for me) - but I particularly notice that Firefox supports ogg and wav
media while safari supports mp3 (damn those committees).
My best attempt so far is below - but I wonder if this is the best way
to go about it (is there a better way of detecting a browser type? I
saw that jQuery has something - is it better to use it - and do
something on a page load script to set the src attribute of a single
myRequest := self requestContext request. "for debugging - but
confused the hell out of me that I needed a variable"
(myRequest userAgent beginsWith: 'Mozilla')
url: (MyLibrary default urlForFile: 'sound.wav');
id: 'noise' ]
url: (MyLibrary default urlForFile: 'sound.mp3');
id: 'noise' ].
onClick: ((html jQuery id: 'noise') each: (JSStream this call:
with: 'Do It'.
More information about the seaside