JavaScript - different browser output
You can easily use JavaScript to create different outputs for different browsers. You may simply check the browser and then generate a browser typical output:
sample JavaScript code:
<script type="text/javascript"><!--
var _app = navigator.appName;
if (_app == 'Netscape')
{
document.write('This site is viewed with Netscape Navigator,
Mozilla Firefox or Apple Safari');
}
else if (_app == 'Konqueror')
{
document.write('This site is viewed with Konqueror');
}
else if (_app == 'Opera')
{
document.write('This site is viewed with Opera');
}
else if (_app == 'Microsoft Internet Explorer')
}
document.write('This site is viewed with Microsoft Internet Explorer');
}
else
{
document.writeln('You browser is not supported!);
document.writeln('Browser: ' + _app + '.');
}
//--><script>
This is a possibility to react on some special browser behavior like the way style sheets are interpreted. I used it to embed Java™ applets depending on the browser that is used to view the page. Because Microsoft Internet Explorer needs some extra treatment to embed Java™ applets using XHTML compliant code.