Search code examples
javascriptwebviewdpiwindows-10-universal

turn off x-ms-webview autoscaling


I use a full-screen x-ms-webview to display a webapp.

The web component is zoomed just like if on Internet Explorer I select "150%".

How can I force the webview scale to 100% programmatically?

I don't know if this is related to the dpi-aware mode at How do I enable dpiAware? , in such a case I'd like to know where to insert the proposed changes to the manifest, as Visual Studio Windows 10 express seems to have a different Manifest format (package.appxmanifest)


Solution

  • Found that webview accurately responds to @-ms-viewport selector, so I was able to configure the screen to fit my needs. Also found that window.devicePixelRatio is updated accordingly.

    @-ms-viewport {
        width: 1920px;
        height: 1080px; 
    }
    

    or

    @-ms-viewport {
        width: device-width;
        height: device-height; 
    }