If you embed IE in a windows application, you may notice that it runs in IE7 Emulated mode. This is likely NOT what you want.
I’ve added code like below to solve the problem:
string appName = "";
appName = Path.GetFileName(Assembly.GetEntryAssembly().Location);
const string IE_EMULATION = @"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION";
MessageBox.Show(appName + "\n" + ex.ToString(), "Unexpected error setting browser mode!");
using (var fbeKey = Registry.CurrentUser.OpenSubKey(IE_EMULATION, true))
fbeKey.SetValue(appName, 9000, RegistryValueKind.DWord);
There’s a special registry key that must be set before IE9 loads and is navigated … it must be set to the name of your application. Oddly, not the full path to your application, just the name of your executable.
You may want to delete this registry setting when your application exits.
It’s been a long time since v2 of the Html Grabber.
I updated the Html Grabber earlier this year in response to some requests at work. It was performing poorly with long documents, and occasionally crashing in a few edge cases. I rewrote a few portions of the core code and created a new shell in .NET.
The core functionality is basically the same. Press and hold the primary mouse button on the button. Then, with the mouse button still pressed, drag and point at a window/region that you believe is using Internet Explorer. If it is, the cursor changes to include a small green circle. You may then release the mouse button to capture the contained HTML.
Once captured, double-click on the capture row and then paste the results into your favorite text editor (ideally, a syntax highlighting editor).
As usual, use at your own risk. It’s designed for debugging, so treat it accordingly. It’s been tested with IE8 and IE9. It requires .NET 4.0.
Download it here. (Yes, the file name is called v2 … don’t worry, it’s correct). There’s no installer, just run the included EXE.