I do very simple thing: I need to change VIDEO tag size via InvokeScript of WPF WebBrowser control.
So it shows "Hello" but size doesn't changes at all.
Note: If i open this page directly it changes size fine for any browser.
private void btSize_Click(object sender, RoutedEventArgs e)
{
wb.InvokeScript("SetVideoSize");
}
function SetVideoSize() {
try {
document.getElementById("player1").style.height = '400px';
document.getElementById("player1").style.width = '400px';
alert('Hello2');
} catch (e) {
// alert(e.Message);
}
}
<video width="10" height="10" style="margin: 0 !important; padding: 0 !important;
overflow: hidden;" id="player1" name="mplayer1" src="http://mysite.com/files/werweB" type="video/mp4">
</video>
<script type="text/javascript">
MediaElement('player1',
{
success: function (me) {
me.play();
}
});
</script>
I even tried to do:
mshtml.HTMLDocument doc = (mshtml.HTMLDocument)wb.Document;
var player = doc.getElementById("player1");
player.setAttribute("width", "400");
player.setAttribute("height", "400");
But there is no any visual changes at all...
I spent two days searching and this is what I found:
All you have to do is add the following meta
tag to your HTML:
<meta http-equiv="X-UA-Compatible" content="IE=9" >
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.