Hi how can i include new <meta> in html header of screen of jmix application

Hi i’d like to add something like this to html header. How can i proceed?

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"> 

Hi @igisho
You can change your DOM like this:

@Component("MyBootstrapListener")
public class MyBootstrapListener implements BootstrapListener {
    @Override
    public void modifyBootstrapFragment(BootstrapFragmentResponse response) {

    }

    @Override
    public void modifyBootstrapPage(BootstrapPageResponse response) {
        Element head = response.getDocument().head();

        head.appendElement("meta").attr("name", "viewport")
                .attr("content", "width=device-width, initial-scale=1.0");
    }
}
1 Like

Thank you, worked like charm!

1 Like