Hi Team ,
Kindly is their is any direct way to add below tag to xml instead of using JQuery
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
Thanks
Hi Team ,
Kindly is their is any direct way to add below tag to xml instead of using JQuery
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
Thanks
Hi,
You can add the following properties in the web-app.properties
file to affects viewport
meta tag of Vaadin HTML pages:
cuba.web.useDeviceWidthForViewport = true
cuba.web.pageInitialScale = 1
The result will be as follows:
<meta name="viewport" content="width=device-width, initial-scale=1">
There is no property to define maximum-scale
, but you can extend CubaBootstrapListener
and provide viewport
meta tag there.
import com.haulmont.cuba.web.sys.CubaBootstrapListener;
import com.vaadin.server.BootstrapPageResponse;
import org.jsoup.nodes.Element;
public class CustomBootstrapListener extends CubaBootstrapListener {
@Override
public void modifyBootstrapPage(BootstrapPageResponse response) {
Element head = response.getDocument().getElementsByTag("head").get(0);
includeMetaViewport("width=device-width, initial-scale=1, maximum-scale=1", response, head);
}
}
Register a new bean in web-spring.xml
:
<bean id="cuba_BootstrapListener"
class="com.haulmont.sampler.web.CustomBootstrapListener"/>
Regards,
Gleb
Thanks ,
It worked fine for us