I want to disable Zoom In and Out feature of web browser control in wp8

 private void webBrowserDescription_LoadCompleted_1(object sender, NavigationEventArgs e)
 {
     this.webBrowserDescription.InvokeScript("eval", new[] { "document.getElementsByTagName('head')[0].appendChild('<meta name=\"viewport\" content=\"width=device-width,user-scalable=no \">')"});
 }

But got An unknown error has occurred. Error: 80020101.

How can I resolve this to disable Zoom in - Zoom Out feature

Answers


Try this

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

Are you able to use a meta tag in the page header? I don't know if wp8 recognizes those or not. e.g.

<meta name="viewport" content="user-scalable=no, initial-scale=1, 
maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, 
target-densitydpi=device-dpi" />

I got Solution by chainging my way,here i used navigateToString instead of InvokeScript method:

BrowserControl.LoadCompleted += Browser_LoadCompleted;
private void Browser_LoadCompleted(object sender, NavigationEventArgs e)
{
  string myhtml = BrowserControl.SaveToString();
  string mataTag = "<meta name=\"viewport\" content=\"width=320,user-scalable=yes\" />";
  myhtml = html.Insert(html.IndexOf("<head>", 0) + 6, mataTag);
  BrowserControl.NavigateToString(html);
  BrowserControl.LoadCompleted -=  Browser_LoadCompleted;
}

Need Your Help

Android Glide old images are loaded on scroll

android image gridview android-glide

I'm using Glide and I download and display all images in my Gridview. But I have a problem when I'm scrolling in my gridview during the download. Glide load the previous images and replace them by ...

Rotating states in a Blend 4 VisualStateManager based on timer events?

silverlight xaml silverlight-4.0 blend visualstatemanager

I'm building a Silverlight 4 UserControl in Blend which has three VisualStates.