Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
566 views
in Technique[技术] by (71.8m points)

windows - 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 + "
";
  txt += "Browser Version: " + navigator.appVersion + "
";
  alert(txt);

and i receive the following alert: enter image description here

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

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

Thanks,

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...