Add viewport meta tag when responsiveCss option is enabled.

Issue #38 resolved
Mauricio Schneider created an issue

This is just a suggestion.

According to bootstrap's documentation the following meta tag must be included in order to display responsive pages properly on devices:



<meta name="viewport" content="width=device-width, initial-scale=1.0"> }}}

It would be nice if the extension itself could add this meta tag when the responsiveCss option is set to true in the configuration file so you don't have to add it manually.

Best regards, and thanks for your hard work.

Comments (6)

  1. suralc

    Should be as simple as replacing (components/Bootstrap.php/L:64)

    #!php if ($this->responsiveCss) $this->registerResponsiveCss();


                    if ($this->responsiveCss) {
                             Yii::app()->clientScript->registerMetaTag('viewport', 'width=device-width, initial-scale=1.0');
  2. Horizons

    On Problem i think the viewport should not be added when you use it in an ajax requets. so therefore better something like this should be used. Otherwise i always get additional viewports added to my code.

    if (!Yii::app()->request->isAjaxRequest)
    $cs->registerMetaTag('width=device-width, initial-scale=1.0', 'viewport');
  3. Асанов Ильдар

    Please, help. How to remove this meta tag? In my projects this element is unacceptably. (sorry for my english).

    Agreed: I commented out the following line in Boostrap.php:

    $cs->registerMetaTag('width=device-width, initial-scale=1.0', 'viewport');

    Is this the right way?

  4. Log in to comment