当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - Windows 8 Open Desktop IE10

问题描述:

When IE10 is the default browser on Windows 8, and Internet Options -> Programs -> Choose How You Open Links is set to Always in Internet Explorer, when you open a new process by URL, it opens in Metro version of IE10.

There are 2 ways around this that I can think of, but I haven't found a way for either yet.

  1. Pass an argument to iexplore.exe that tells it to open on the desktop.
  2. Programatically change the value of that Internet Option in the registry, open the URL, then set it back to whatever it was set to previously.

I have a feeling that #2 is the route I'd have to go down, however, looking in the registry at HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings I can't see anything that would even remotely resemble that setting.

Has anybody tackled this problem before and can provide any insight?

This is NOT an ethical problem - I simply need to know where the setting is, or if there's a way to force it into desktop via an argument. I really REALLY don't need to know that this isn't ideal; I'm fully aware of that fact already.

网友答案:

Now that we understand your scenario (automated testing), we can explain how to do this correctly, and it doesn't involve overriding any user settings, not even temporarily. It also works even if the user set their default browser to something other than Internet Explorer.

What you do is open an explicit Desktop version of Internet Explorer and navigate it to your site. Here's an example in JavaScript. You can adapt this to C# with a little bit of importing, or you can go for the overachiever solution and just host IE inside your C# application.

var ie = new ActiveXObject("InternetExplorer.Application");
ie.Visible = true;
ie.Navigate("http://www.microsoft.com/");
WScript.Sleep(5000); // five seconds, say
ie.Quit();
网友答案:

How to force IE to open in desktop mode on Windows 8

If a user WANTS it in Metro and work all in the time in Metro, would be pretty annoying for him to switch back to desktop mode when using a URL. Hopefully, that webpage is what you want.

分享给朋友:
您可能感兴趣的文章:
随机阅读: