0


I have a WebBrowser control inside a WinForm (C#), this WebBrowser load a page that have a css like this:

button {
    border: 0;
    width: 280px;
    height: 120px;
    position: relative;
    text-align: center;
    border-radius: 22px;
    padding: 3px 0px 3px 3px;
    margin: 5px 1px 3px 0px;
    transition: 0.3s ease-in-out box-shadow;
}

    button:hover {
        box-shadow: 0 0 18px rgba(81, 203, 238, 1);
    }

    button:active {
        box-shadow: 0 0 18px rgba(81, 203, 238, 1);
    }

This works in IE, when i touch (is a touch-screen) the button it's higlighted with bow-shadow but not work in WebBrowser inside WinForm, only occurs when the button is released, and I don't undestrand why.

thanks in advance for the help.
Dan

Danilo
  • 631
  • 1
  • 9
  • 24

1 Answers1

1

This is because the WebBrowser control renders in IE7 mode, by default. To override this behavior, you have two ways:

  • Using the IE X-UA-Compatible Meta header
  • Using Application specific FEATURE_BROWSER_EMULATION Registry Keys

I think you have full control of the page loaded, so I suggest you to use the first way:

<!DOCTYPE html>
<html> 
  <head> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
    ... other headers
  </head>
  <body>
    ... content
  </body>
</html>

Source: https://weblog.west-wind.com/posts/2011/may/21/web-browser-control-specifying-the-ie-version

If you don't have control of html code, read the source above to find a detailed explanation of the topic.