When I embed the WebBrowser control in a window using either Active-X or the .NET WebBrowser control (thin wrapper around the Active-X) control, it doesn't seem to respect @media css attributes such as max-width. Given {fiddle}:
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <!-- necessary for tablets -->
<style>
#redBox {
background-color: red;
}
#blueBox {
background-color: blue;
}
@media (max-width: 1000px) {
#redBox {
display: none;
height: 0px;
}
}
</style>
</head>
<body>
<div id="redBox"> Red Box </div>
<div id="blueBox"> Blue Box </div>
</body>
</html>
The red box should disappear when you make the window smaller than 1000px.
This works in Chrome, Firefox and IE. However, when I load the page in a WebBrowser control using the .NET WebBrowser
control, or a unmanaged application using the Shell.Explorer
Active-X control, the change doesn't work. It doesn't matter if I load it using a file:///
attribute or with http.
Any idea how to make it work?