本文介绍了.net webbrowser控件不像本地IE那样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我在下面有一个测试html文件。当我在IE(v11)中运行时,它会按预期运行。 但是当我在c#中导航到带有WebBrowser控件的文件时,表单中为空白项目,只显示地图和标记(VS2015)。 它在基础设施升级IE之前工作到11,而WebBrowser使用本地IE版本。 webBrowser1.Version.ToString返回11.0.9600.18283。 所以我的怀疑是围绕IE11的安全性。 所以我的问题是:我有任何关于WebBrowser控制安全性(我无法找到任何东西)我可以尝试或在HTML中的任何东西我可以尝试获取webbrowser控制工作正常。 <! - 保存自url =(0011)about:blank - > < !DOCTYPE html > < ; head > < meta http-equiv = content-type content = text / html; charset = UTF-8 / > < title > Google Maps API v3说明示例< / title > < script 类型 = text / javascript src = http://maps.google.com/maps/api/js?sensor=false > ; < / script > < / head > < body style = font-family:Arial; font-size:12px; > < div style = width:600px; > < div id = map style = width:280px;身高:400px; float:left; > < / div > < div id = panel style = width:300px; float:right; > < / div > < / div > < script type = text / javascript > var directionsService = new google.maps.DirectionsService(); var directionsDisplay = new google.maps.DirectionsRenderer(); var map = new google.maps。地图( document .getElementById (' map'),{ zoom: 7 , mapTypeId:google.maps.MapTypeId.ROADMAP }); directionsDisplay.setMap(map); directionsDisplay.setPanel( document .getElementById(' 面板)); var request = { origin:' 芝加哥',目的地:' 纽约', travelMode:google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(请求,功能(响应,状态){ if (status == google.maps.DirectionsStatus.OK){ directionsDisplay.setDirections(response); } }); < / script > 我的尝试: 我已经尝试了几个版本的 <! - 保存自url =(0011)about:blank - > 虽然它停止提示它IE但它不会改变webbrowser中的任何内容。 解决方案 引用:它之前是工作的基础设施将IE升级到11并且WebBrowser使用本地IE版本 这并不完全正确。是的,它正在使用IE浏览器。不,它没有使用IE11渲染引擎。它默认使用IE7渲染引擎。 阅读 this [ ^ ]可以很好地解释发生了什么以及如何修复它。 I have a test html file below. When I run it in IE (v11) it runs as expected.However when I navigate to the file with a WebBrowser control in c# on a form in a blank new project, only the map and markers is displayed (VS2015).It was working prior to the Infrastructure upgrading IE to 11 and as WebBrowser uses the local IE the version. webBrowser1.Version.ToString returns 11.0.9600.18283.So my suspicions are round the security of IE11.So my question is: I there any on WebBrowser control around security (I cant find anything) I can try or anything in the html I could try to get the webbrowser control to work correctly.<!-- saved from url=(0011)about:blank --><!DOCTYPE html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Google Maps API v3 Directions Example</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> </head> <body style="font-family: Arial; font-size: 12px;"> <div style="width: 600px;"> <div id="map" style="width: 280px; height: 400px; float: left;"></div> <div id="panel" style="width: 300px; float: right;"></div> </div> <script type="text/javascript"> var directionsService = new google.maps.DirectionsService(); var directionsDisplay = new google.maps.DirectionsRenderer(); var map = new google.maps.Map(document.getElementById('map'), { zoom:7, mapTypeId: google.maps.MapTypeId.ROADMAP }); directionsDisplay.setMap(map); directionsDisplay.setPanel(document.getElementById('panel')); var request = { origin: 'Chicago', destination: 'New York', travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } }); </script>What I have tried:I have try several versions of the<!-- saved from url=(0011)about:blank -->and although it stop the prompting it IE it does not change anything in the webbrowser. 解决方案 Quote:It was working prior to the Infrastructure upgrading IE to 11 and as WebBrowser uses the local IE the versionThat's not entirely true. Yes, it's using IE. NO, it's not using the IE11 rendering engine. It's using, by default, the IE7 rendering engine.Read this[^] for a good explanation of what's going on and how to "fix" it. 这篇关于.net webbrowser控件不像本地IE那样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 22:37