How to disable zoom in Windows 8 webviews

2019-06-20 05:56发布

I'm using a webview in an app to display externally hosted content, but the web view lets the user zoom with a pinch gesture and I'd like to disable this.

I can't find any such property on the webview itself, and I've not had any success with a viewport meta tag such as:

<meta name="viewport" content="user-scalable=no">

Is there a way to do this?

3条回答
叛逆
2楼-- · 2019-06-20 06:04

Just put a

<Rectangle Fill="Transparent"/>

over the webview and that is it.

查看更多
放我归山
3楼-- · 2019-06-20 06:10

Unfortunately this is not possible.

http://social.msdn.microsoft.com/Forums/en-AU/winappswithcsharp/thread/8eecf85d-ebd3-4bc0-ad17-15f342efad25

If the WebView works similarly to the WP7 version then you may be able to catch the events in html and cancel them there similarly to this.

查看更多
4楼-- · 2019-06-20 06:11

I was able to disable pinch and zoom in Windows 8.1 WebView using following in CSS:

html, body
{
  -ms-content-zooming:none;    
}

There's a long list stuff try: http://msdn.microsoft.com/en-us/library/ie/hh771891(v=vs.85).aspx

查看更多
登录 后发表回答