MSIEs WebBrowser control hosted in winforms app runs in compatibility mode - winforms

I'm hosting MSIE in a winforms form. Unfortunately it insists on running in compatibility mode regardless of if I give it a page that runs in IE8 mode in stand-alone IE. The effect of that is that some content that renders correctly in stand-alone MSIE gets completely mis-aligned and messed up in the hosted control.
Besides document type etc, is there some magic way to tell the webbrowser that I want it to render the page the same way as if I loaded it in stand-alone MSIE?
I don't want to use the registry key override ( http://blogs.msdn.com/b/ie/archive/2009/03/10/more-ie8-extensibility-improvements.aspx ) due to my form being part of an add-in for another app. I don't want to change the IE behavior for the main app and I don't want to change it for other add-ins running under that app. I only want this to work within the browser hosted in my form, not app-wide and not process-wide.

I have not tested this, but how about using the META tag, along with the HTTP-EQUIV attribute, to set the X-UA-COMPATIBLE value to IE=8, which instructs the web browser to display a page in IE 8 standards mode. An example would be:
<meta http-equiv="X-UA-Compatible" content="IE=8" />
From this line in the following article it seems that this should work.
By default, applications hosting the
WebBrowser Control open
standards-based pages in IE7 mode
unless the page contains an
appropriate X-UA-Compatible header.
You can change this by adding the name
of the application executable file to
the FEATURE_BROWSER_EMULATION feature
control key and setting the value
accordingly.

To change the default behavior of the Web Browser Control running in your application to match what IE itself does, you must set the FEATURE_BROWSER_EMULATION Feature Control Key.
For instance, you can mimic IE8's behavior (allowing sites to render in IE8 standards mode) as follows.
Inside HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\FeatureControl
Create a new key named FEATURE_BROWSER_EMULATION
Inside that key, add a new REG_DWORD with value 8000 with the name of your application's executable. E.g.:
"YourApp.exe" = dword 8000 (Hex: 0x1F40)
Further details are at:
http://blogs.msdn.com/b/ie/archive/2009/03/10/more-ie8-extensibility-improvements.aspx

Related

XAML WebBrowser emulation without registry change

I am trying to render some HTML page of mine hosted on a NodeJS in a WPF app.
I have tried few things and the following option seems the most convenient:
C# webbrowser Ajax call
However it is modifying the registry which I cannot (company policy).
Therefore would there be a way to do the same on the fly? ie. load the WebBrowser with this setup without updating the registry?
Thank you
You might be able to do this with the XUA compatible meta tag.
<meta http-equiv="x-ua-compatible" content="IE=11">
I don't know if you have access to the site's content or not. If you do, then just put in right there in the HTML.
If you do not own the page, there are ways modify the page and dynamically inject this tag with a bit of com interop from mshtml.
Therefore would there be a way to do the same on the fly? ie. load the WebBrowser with this setup without updating the registry?
I am afraid not. There is no property or method of the WebBrowser control itself that you can set or call.
Changing the registry keys or use another (third-party) control are your only options I would say.

Integration of Vimeo's video in WPF

We have an account on Vimeo where we display some videos for specific viewers. They are privates and we customize the ui's player to disable the share's options. The only thing that the viewer can do it's play the video.
Moreover, we defined a only one specific domain where the videos can be integrated. So we have some webpages on this domain where we integrate the videos.
In a webbrowser like Firefox, Chrome or Edge, if we go on a webpage hosted on this domain, there are no issue to display and play it. But if we use the WPF webbrowser, the webpage can be display with the video, but the Vimeo's player show a message that we can read the video because of privacy settings that we defined.
Why in a browser like Firefox or other, I don't have any issue or message to play the video from a webpage on my domain (what we want) and in the WPF webbrowser, the Vimeo's player don't allow me to play the video on the same webpage in my domain ?
Thank's for help.
The WPF WebBrowser control uses the Internet Explorer ActiveX control embedded within its window. So, it has the same limitations as the installed version of Internet Explorer. By default, it will be using IE 7 compatibility so more modern JavaScript may not work quite right.
You can force the control to use a more modern rendering engine either by using a fixed DOCTYPE in the HTML (but obviously, you don't control Vimeo's HTML) or for any launch of your executable on the machine by setting a registry key as described in this Microsoft article: Browser Emulation
You will need to add an entry for your .exe name. For example, if your application is myviewer.exe, it would be something like this to get IE 11 rendering.
HKEY_CURRENT_USER
SOFTWARE
Microsoft
Internet Explorer
Main
FeatureControl
FEATURE_BROWSER_EMULATION
myviewer.exe = (DWORD) 00011000

reCAPTCHA v2 with wpf webbrowser / frame control

reCAPTCHA has limitation on browser supports however it works on IE without adding any value in compatibility mode. I have been trying multiple things with WPF application which is displaying a webpage hosted inside a Frame (or Web Browser) control. That webpage has Google reCAPTCHA V2 (I'm not a robot). It works fine in all the browsers but inside WPF app it fails to display properly.
Based on following link we need to have specific browser support
https://support.google.com/recaptcha#6262736
I also made sure javascripts are enabled and working fine. Any suggestion?
I ran into this issue as well and the only thing I know how to make it work is go into the recaptcha admin console and slide the security preference to the easiest so the webBrowser control can do the image verification at the very least
Update:
Found out basically because the web browser control is IE 7 by default
Use latest version of Internet Explorer in the webbrowser control

IE document compatibility in iFrame

I have a web application that is used in an iframe by a web portal (SAP enterprise portal). The portal responds with header x-ua-compatible IE=EmulateIE7. This messes up my application which uses AngularJS. I tried following in my application but it does not work. How can I tell IE to use standard mode with my application?
Note changing the portal is not an option at this time.
<meta http-equiv="X-UA-Compatible" content="Edge"/>
What do you mean by "Note changing the portal is not an option at this time."?
the best option is use header
in the page with angular application
othewise you could use the Iview DocumentObjectModel this iview has the property to define with way you want this page gets rendered
you could choose between
IE7Emulated
standards with it's edge mode for IE

Silverlight 5 app from iframe not closing in IE9

I am developing a web application using Dojo v1.8 and my target machine runs IE9 and Silverlight 5.1.20125. In this web app, the user can select a tool from a toolbar at the top of the page that will open up in a content pane (or an IFrame if it is an external tool) below the toolbar (only one tool can run at a time).
The bug I am encountering is that one of the external tools that opens in an IFrame runs a Silverlight app, and if the user tries to select another tool, the new tool won't open and the Silverlight application stays there. After checking the DOM Tree, all references to the Silverlight application have been wiped, and the new tool is there instead (which is the desired behavior).
So my question is, why is the Silverlight Application still being viewed even when it is gone from the DOM Tree, and is there a way to programmatically close it from Javascript? Also, I do NOT have access to the source code of the Silverlight Application.
Well I did not manage to solve this issue directly. However, there was another bug that I ran into which involved the java swing library not working on the production machine. The solution was to add the following tag as the first element of head:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8>
This forces IE to use IE8 instead of IE9. This trick solved this other issue, but inadvertently solved this issue as well. Here are several links that helped lead me to the solution (amongst others):
http://sourceforge.net/p/djproject/discussion/671154/thread/d7662f61
http://msdn.microsoft.com/en-us/ie/ff959805.aspx#_Compatibility_issues_with_1

Resources