I'm not saying this is a perfect solution, but it works. It's an shtml conditional include, which tests whether the browser is IE, FF or something else, and gives the appropriate code for that browser. I've also made the link to our radio feed open in a popup, so the stream doesn't have to reload when people move from page to page. I've also created an M3U playlist file, which contains the link to the source of the stream.
JS to include in header of every page the link is on, or external JS file:
Code:
<script type="text/javascript">
<!--
function popup(mylink, windowname){if (! window.focus)return true;var href;if (typeof(mylink) == 'string') href=mylink;else href=mylink.href;window.open(href, windowname, 'width=300,height=50,scrollbars=yes');return false;}
//-->
</script>
Link:
Code:
<a href="url_of_browser_test_file_here"
onclick="return popup(this, 'notes')"> Radio</a>
SSI for bowser test file (I use index.shtml in subfolder media)
Code:
<!--#if expr="${HTTP_USER_AGENT} = /MSIE/" -->
<!--#set var="ret" value="ie" -->
<!--#elif expr="${HTTP_USER_AGENT} = /Mozilla/ && $brtype !=/msie/" -->
<!--#set var="ret" value="ff" -->
<!--#else -->
<!--#set var="ret" value="ob" -->
<!--#endif -->
<!--#include file="$ret.txt" -->
Now 3 text files are required: ie.txt (with settings for IE), ff.txt (with settings for FF) and ob.txt (with settings for other browsers).
M3U file simply contains the IP of the stream, or URL thereof.
my ff.txt file simply says:
Code:
<embed src="stream.m3u" autostart="true" loop="0" type="application/x-mplayer2" height="45" width="300">
</embed>
Above will replace the whole SSI conditional statement for any browser which tests true for returning Mozilla as the user agent.
Yes, I like SSI. And no, this is probably not the perfect solution.