Nathan
Nathan

Reputation: 11

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

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.

Upvotes: 1

Views: 145

Answers (2)

Ali_Hr
Ali_Hr

Reputation: 4675

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.

Upvotes: 1

mialdi98
mialdi98

Reputation: 73

  • [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.

Upvotes: 0

Related Questions