WebBrowserComponent


#1

firstly, is there any way to specify which browser to use. it seems it always runs an IE image.

Given that you have to have an IE browser here, there’s a nasty problem waiting to bite. Using the `WebBrowserComponent’ i get a truckload of errors; script errors, security failure. etc etc. Turns out that IID_IWebBrowser2 interface actually runs IE7 for “compatibility” reasons!!

So, how do you get it to run the proper one. turns out you have to add something nasty to your registry in HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION. (dont you just love it!)

Anyhow, here’s a nasty hack i do to correct the registry in my app.

[code]void SomeClass::fixWindowsRegistry()
{
#ifdef JUCE_WINDOWS

// want to add a key of the form
// <binaryname>.exe  DWORD  9999
// 9999 indicates IE9 

String keypath = "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION\\";

// build the full path to the key
String key = keypath + JUCEApplication::getInstance()->getApplicationName() + ".exe";

// this is the value we want
unsigned int correctValue = 9999;
bool ok = false;

// lets look for it anyway
bool v = WindowsRegistry::valueExists(key);
if (v)
{
    MemoryBlock data;
    unsigned int sz = WindowsRegistry::getBinaryValue(key, data);
    if (sz == 4)             // DWORD
    {
        int val = *(unsigned int*)data.getData();
        if (val == correctValue)
            ok = true;
    }
}

if (!ok)
{
    WindowsRegistry::setValue(key, correctValue);
}

#endif
}[/code]

if anyone has a better idea, i’d wecome it!

– hugh.


#2

Yeesh… nasty! Doing a quick search shows that a load of other people are also doing the same thing, even in C#, so I guess there’s no other way around it. Bizarre that there’s not some kind of option on the IWebBrowser2 class that would give more control.


#3

I dont like it either.

Does anyone know if there’s a way to encapsulate another browser as a control. Juce has some classes for ActiveX controls, can other browsers be put inside. if so, how?

one last thing for my hack. it shouldn’t regress the value of this key, in case a newer browser comes along (but how it could know to increase it, i dont know).

int val = *(unsigned int*)data.getData(); if (val >= correctValue) ok = true; }


#4

Hi,

I'm trying to use WebBrowserCompononent too and encountered the same issue. I have no trace of IE7 on my Windows7 (even in the Windows Features)  but I have IE11, so I want Juce to use this version.
Using your hack, I saw somewhere else that IE11 code instead of 9999 should be 11000, but even with 9999, my div displaying the browser version still indicates Internet Explorer 7.

I checked and fixWindowsRegistry() is called, so I don't see where the issue is. Does someone have any clue?

Thanks in advance.