Besides the great responsive frameworks and themes provided by Drupal like Adaptivetheme, Omega...etc there is a strong need for browscap. Browscap is a very simple module that provide you with browscap_get_browser() function, which return more details about the current user agent & browser. Lets use it to hide a specific block in mobile devices
1- Open your block settings from Structure > Blocks > Configure
2- From visibility settings , select "Pages on which this PHP code returns TRUE (experts only)"
3- And inside the text area add the following code
<?php $mobile_agent = browscap_get_browser() ; if($mobile_agent['ismobiledevice'] == "false"){ // if user agent is not a mobile device, then show me the block return true; } ?>
We are done... :) Good luck !
Comments
How about it for Drupal 8
Just want to know how to set it for Drupal8?
thanks in advance.
Add new comment