WeLoveCSS Logo
Home Profile Members Search Rules Help New Posts



WeLoveCSS > PROGRAMMING LANGUAGES > Scripting and Server Side > Media Type Script

Reply
  Thread Tools Display Modes
Old 19th August 11, 07:50 PM   #1
PapaGeek
WLC Lover
 
Join Date: Aug 2010
Posts: 68
Default 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.
PapaGeek is offline   Reply With Quote
Reply


Thread Tools
Display Modes
Linear Mode Linear Mode

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:00 AM.



Home | Advertise | Contact Us | Top
Home | Advertise | Contact Us | Top

Copyright© 2006 WeLoveCSS.com. All Rights Reserved.
Powered by vBulletin Version 3.8.4 Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.