WebView content not using full width?

DerProgrammiererDerProgrammierer DEMember ✭✭✭

I created a blank project and placed a WebView in my MainPage:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:SampleWebView"
             x:Class="SampleWebView.MainPage">
    <Grid BackgroundColor="Blue">
        <WebView VerticalOptions="FillAndExpand"
                 HorizontalOptions="FillAndExpand"
                 Source="https://widgetview.optadata-one.de/content/oddc.notes/?cache=1508420013750"/>
    </Grid>
</ContentPage>

Problem: The content of the WebView does not seem to fill the whole screen width, even with HorizontalOptions being "FillAndExpand". It works with other sites, for example https://www.google.com fills the whole page. But with a widget from my company, it won't work. Unfortunately you can't test it with this site because it needs a logged in user from our intranet, but I will attach a screenshot:

I added a BackgroundColor to the grid, but there is no blue space so I assume that the WebView itself takes the full width, but the content for some reason does not. I already checked if the website contains a margin, but that's not the case.

If I open the same website in a browser on my computer, it works as expected and the website takes the full width:

Any ideas what I'm doing wrong? Or is this a bug in WebView?

Tagged:

Answers

  • Have you tried debugging the webview using chrome and inspecting the content (I actually find Opera/iOS is a little less temperamental than Chrome/Android if you have a mac handy)

Sign In or Register to comment.