Note that there are some explanatory texts on larger screens.

plurals
  1. POWindows Phone 7 WebBrowser content height
    text
    copied!<p>I want to set the height of <code>WebBrowser</code> control dynamically, depending on the content height. </p> <p>My scenario is: On that specific view I have different elements - an Image, MediaElement etc. and between those rich text that is presented in that WebBrowser control. To achieve unified scrolling I have wrapped all content in a scrollview and disabled scrolling on the webbrowser control.</p> <p>Currently I have a <code>JavaScript</code> method that gets called when body has done loading and sends the height information to <code>C#</code> codebehind but the calculated height is incorrect. </p> <p><strong>My hack today</strong> is to basically multiply the returned value with about <strong>1.75</strong>.</p> <p>In the page head I have the following meta tags:</p> <pre><code>&lt;meta charset='Windows-1257'&gt; &lt;meta name='viewport' content='width=device-width' /&gt; &lt;meta name='viewport' content='user-scalable=no' /&gt; &lt;meta name='viewport' content='initial-scale = 1.0' /&gt; &lt;meta name='HandheldFriendly' content='true' /&gt;" &lt;meta name='target-densitydpi=device-dpi' /&gt; </code></pre> <p>This is my <code>body</code> tag. </p> <pre><code>&lt;body onLoad="SendDataToPhoneApp()" style="margin:0px;padding:0px;"&gt; </code></pre> <p>My <code>JavaScript</code> functions:</p> <pre><code>&lt;script&gt; function getDocHeight() { return document.getElementById('pageWrapper').offsetHeight; } function SendDataToPhoneApp() { window.external.Notify('' + getDocHeight()); } &lt;/script&gt; </code></pre> <p><code>pageWrapper</code> is a direct child of <code>body</code>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload