0
<?php if(strstr($SERVER['HTTP_USER_AGENT'],'iPad')){ ?>

<link rel="stylesheet" type="text/css" href="http://artendijen.com/wp-content/themes/twentytwelve/styleTablet.css">

<?php } ?>

I am trying to detect if the user agent is iPad, but the following syntax above does not work, I applied a display none to an element in the css file and removed the php if statement and checked my ipad and the element was not there.

user1269625
  • 3,121
  • 26
  • 79
  • 111

1 Answers1

1

Here is the code:

<?php if(stripos($SERVER['HTTP_USER_AGENT'],'iPad') !== false){ ?>
<!--here if its ipad-->
<link rel="stylesheet" type="text/css" href="http://artendijen.com/wp-content/themes/twentytwelve/styleTablet.css">

<?php } ?>

This is what user agent for ipad

Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10

Please see here

Community
  • 1
  • 1
Parixit
  • 3,829
  • 3
  • 37
  • 61