简体   繁体   中英

IWebBrowser2 object uses IE7 version, instead of the IE version installed on the machine

I'm developing on a Win7 machine with IE8 browser (same thing occurs also on IE9).

I've create an application with an IWebBrowser2 object embedded within a native window.
Within that browser object i execute a javascipt code:

  var txt = "Browser Name: " + navigator.appName + "\n";
  txt += "Browser Version: " + navigator.appVersion + "\n";
  alert(txt);

and i receive the following alert: 在此处输入图片说明

That confirmed my earlier worries - even when having IE8\\IE9 installed on my machine - the IWebBrowser2 object behaves as if it was IE7 (including all of the annoying HTML\\CSS behaviors).

Does anyone know why this is? or better - if there is any possibility to embed a browser object as IE8\\IE9 (for distribution - so it should be legal)

Thanks,

IE7 is the default rendering mode for embedded IE controls (for compatibility reasons). Use the FEATURE_BROWSER_EMULATION registry key to change that.

Read Plip's answer over here or IEBlog to get an idea how to do this.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM