3

We use the WPF WebBrowser control to display an embedded page. On Windows 8 we observe a strange jumping behavior of elements with css position:fixed while scrolling.

position:fixed is jumping when scrolling

The same page works fine in IE10 on Windows 8 (also FF, Chrome) and in the WPF WebBrowser control on Windows 7.

Has anyone seen this behavior before and knows a fix for the jumping motion?

Is it possible the .NET Version 4.5 used on the test machine (Surface with Win 8) be the Problem as compared to the .Net Version 4 on the dev machine?

The Development Environment:

  • Windows 7
  • Microsoft Visual Studio 2010 Version 10.0.30319.1 RTMRel
  • Microsoft .NET Framework Version 4

The Test Environment:

  • Surface
  • Windows 8
  • Microsoft .NET Framework Version 4.5

Client XAML:

<Window x:Class="EmbeddedBrowserTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <WebBrowser HorizontalAlignment="Stretch" Name="webBrowser" VerticalAlignment="Stretch" Grid.Row="1" />
    </Grid>
</Window>

Demo Page HTML:

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=9" />
    <title>minimal position fixed example</title>
    <style>
        body {
            margin: 0px
        }           
        .header{
            height: 60px;
            width: 960px;
            background-color: #cccccc;
            top: 0px;
            left: 0px;
            position: fixed;
            z-index: 10;
        }    
        .content{
            padding-top: 60px;
            height: 420px;
            width: 960px;
            background-color: lightsteelblue;
        }    
    </style>
</head>

<body>
    <div class="header">
        header
    </div>    
    <div class="content">
        content <br> 1 <br> 2 <br> 3 <br> 4 <br> 5 <br> 6 <br> 7 <br>
    </div>                
</body>

</html>
snies
  • 3,461
  • 1
  • 22
  • 19
  • I believe the WebBrowser control in WPF is actually just a wrapped WinForms control, I wonder if this is related? I wonder what would happen with a embedded web browser in a WinForms project? – Alan Sep 11 '13 at 15:43
  • Unable to reproduce, sorry (Windows 8, .Net 4.5, ie 10)... – UIlrvnd Sep 11 '13 at 21:18

2 Answers2

3

If there are discrepancies in behavior of the same web page loaded into WebBrowser control and standalone IE browser, the problem can often be fixed by implementing WebBrowser Feature Control.

Once the feature control has been implemented, it makes sense to verify that <!DOCTYPE html> is observed by WebBrowser and the page is actually rendered in HTML5 standard mode, here's how.

[UPDATE] The OP's sample page actually renders correctly when FEATURE_BROWSER_EMULATION is set to 9000 and the META tag is fixed to be <meta http-equiv="X-UA-Compatible" content="IE=9" /> (content="IE9" is not a valid value).

Community
  • 1
  • 1
noseratio
  • 59,932
  • 34
  • 208
  • 486
  • 1
    Thanks for the pointer to the feature keys. We already tried those back when we posted the original error. Unfortunately it did not help at the time. But today after applying the latest updates available for Windows 8 we found the error is gone. – snies Sep 18 '13 at 08:06
0

We checked again on a new Machine also running Windows 8 and the error was gone, after some checks we determined that the new Machine had some new Updates for Windows 8 installed. We went to check for Updates on the Surface and after applying all Updates the Error seems to be gone.

Without any recompilation or further settings just by applying the latest Win 8 Updates the error is fixed.

Scrolling is smooth now. Same executable no changes, so i guess it was some bug in the runtime libs after all.

snies
  • 3,461
  • 1
  • 22
  • 19
  • I will wait 5 hours until @mariusc bounty ends, before accepting my own answer, since the Update fixed it. – snies Sep 18 '13 at 08:14