19th August 11, 07:50 PM
|
#1
|
|
WLC Lover
Join Date: Aug 2010
Posts: 68
|
Media Type Script
Is anyone familiar with the mediatypechecker.js script that you can download from http://cssmedia.pemor.pl/?
If you want to download it (bottom of that page under the buttons) and test it, here is a simple HTML file to use:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 10 Transitional//EN" "http://wwww3org/TR/xhtml1/DTD/xhtml1-transitionaldtd">
<html>
<head>
<script language="JavaScript" src="mediatypechecker.js" type="text/javascript"></script>
<script type="text/javascript">
function CheckScreen()
{
var result = IsMediaType('screen');
if(result > 0) alert('screen medium detected (1)');
else if (result == 0) alert('screen medium not detected (0)');
else alert('error (-1)');
}
function CheckHandheld()
{
var result = IsMediaType('handheld');
if(result > 0) alert('screen handheld detected (1)');
else if (result == 0) alert('screen handheld not detected (0)');
else alert('error (-1)');
}
</script>
</head>
<body>
<p><br>Test:</p>
<br>
<br>
<A HREF="javascript:CheckScreen(0);">Check if current CSS medium is 'screen'?</A>
<br>
<br>
<A HREF="javascript:CheckHandheld(0);">Check if current CSS medium is 'Handheld'?</A>
</body>
</html>
I’m trying to figure out how much of the script might be unnecessary for the browsers that are in use today.
|
|
|