Is it possible to have different html.tpl.php files for different screen sizes?

143 Views Asked by At

As an online publisher, one of our programmatic ad partners is requesting that we have a different html.tpl.php file for responsive screen sizes.

We have a drupal 7 website that one of our ad partners is creating programmatic ad scripts for and would like to send us script for specific screen sizes. Usually this script would be placed in the html.tpl.php file but this partner is asking us to place desktop ad script in a desktop and separate ad script in a mobile

Is this at all possible? Our template is mobile responsive and only has one html.tpl.php file.

2

There are 2 best solutions below

0
mialdi98 On
  • [PHP] You could write statement depends on mobile devices with using mobile_detect module As a little suggestion use simple switch in php.
  • [JS] You just need to get screen/window height and width and than use needed scripts by statement depended on screen size.
0
Ali_Hr On

you can use mobile theme module . install it and set detect method (get browser | php). php is default.

now you can create another theme for mobile devices with different html,css and js.