Project

General

Profile

Meta Viewport

Added by Emeric Poupon almost 9 years ago

Hello,

Unfortunately, I cannot set the meta "viewport"

I tried this:

  • set in wt_config.xml :

        <progressive-bootstrap>true</progressive-bootstrap>
        <meta-headers user-agent=".*"> 
                <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" /> 
        </meta-headers>
    
  • in the code at the construction of my WApplication:

        removeMetaHeader(Wt::MetaName, "viewport");
        addMetaHeader(Wt::MetaName, "viewport", "width=device-width, initial-scale=1.0, user-scalable=no");
    

Nothing works, I always get :

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

It seems to be overridden.

What do you think?

Emeric


Replies (3)

RE: Meta Viewport - Added by Koen Deforche almost 9 years ago

Hey Emeric,

This is indeed the case, the bootstrap theme will also set the viewport meta header on the application (as it's needed per the documentation of bootstrap), if responsive is enabled.

We will fix this by not overriding an existing value.

As a workaround, you could specialize WBootstrapTheme::styleSheets() to reset the viewport to the value you like after calling the base implementation.

Koen

RE: Meta Viewport - Added by Emeric Poupon almost 9 years ago

Indeed it works fine with the workaround you suggested!

Thanks for your support

Emeric

RE: Meta Viewport - Added by Koen Deforche almost 9 years ago

Hey Emeric,

We fixed this also in current git.

Koen

    (1-3/3)