Hello,

does anybody know where to change / remove this line of code: <meta name="viewport" content="width=device-width, initial-scale=0, maximum-scale=7, user-scalable=yes" />?

I gues it should be in the html.tpl.php file... but i cant find it there.

Thank you for your replies;)

Comments

SchieneIII created an issue. See original summary.

SchieneIII’s picture

Issue summary: View changes
SchieneIII’s picture

Assigned: SchieneIII » Unassigned
gge’s picture

Hi,

This is not a Bootstrap specific question. However, in order to alter the viewport meta tag you have to place this code in your .theme file located inside your subtheme folder:

function THEME_NAME_page_attachments_alter(&$page) {
  $viewport = array(
    '#type' => 'html_tag',
    '#tag' => 'meta',
    '#attributes' => array(
      'name' => 'viewport',
      'content' => 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no',
    ),
  );
  $page['#attached']['html_head'][] = [$viewport, 'viewport'];
}

To completely remove this tag use this code:

function THEME_NAME_page_attachments_alter(&$page) {
 // Remove the HTML5 mobile meta-tags.
 $meta_tags_to_remove = [
   'viewport'
 ];
 foreach ($page['#attached']['html_head'] as $index => $parts) {
   if (in_array($parts[1], $meta_tags_to_remove)) {
     unset($page['#attached']['html_head'][$index]);
   }
 }
}
markcarver’s picture

Status: Active » Closed (works as designed)

This is provided by core in system_page_attachments().

There's also a UI module for this if you're not comfortable with altering using core APIs via code: https://www.drupal.org/project/viewport