本文介绍了如何通过 Windows 10 上的注册表找到默认浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows 10 之前的 Windows 版本上,我可以从以下注册表项获取默认浏览器:

On versions of Windows prior to Windows 10, I can get the default browser from the following registry key:

HKEY_CURRENT_USER\SOFTWARE\Clients\StartMenuInternet

在 Windows 10 上,我将 Microsoft Edge 设置为默认浏览器.但我没有看到上面的注册表项有任何变化.

On Windows 10, I set Microsoft Edge as the default browser. But I don't see any change in the registry key above.

但是,在以前版本的 Windows 上它可以正常工作.

However, on previous versions of Windows it works properly.

如何获得 Windows 10 上的默认浏览器?

How can I get the default browser on Windows 10?

推荐答案

从技术上讲,StartMenuInternet 不是默认浏览器,它只是决定了当您点击 Internet 时系统的反应code> 开始菜单中的图标.

Technically StartMenuInternet is not the default browser, it merely determined how the system reacted when you clicked on the Internet icon in the start menu.

在 Windows 10 中,默认应用程序处理是通过以下用户选择键完成的:

In Windows 10, the default application handling is done via the user choice key under:

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Shell\Associations\URLAssociations\(http|https)\UserChoice

其中 (http|https) 是其中之一,例如只是 http 或只是 https

where (http|https) is one of these e.g. just http or just https

ProgId 引用了在调用 url 的 open 时调用的处理程序应用程序 ID.

The key ProgId references the handler application id that is invoked when the open for the url is invoked.

ProgId 值可以通过 HKEY_CLASSES_ROOT 中的键来查找,并且您正在寻找 Shell/Open/command 默认值.对于大多数浏览器,它将是对可执行文件的简单引用.您应该能够使用 Application 键来获取 ApplicationName

The ProgId value can be looked up by key in HKEY_CLASSES_ROOT, and you're looking for the Shell/Open/command default value. For most browsers it will be a simple reference to the executable. You should be able to use the Application key to get the ApplicationName, etc.

现代应用程序将引用带有 DelegateExecute 值的 LaunchWinApp 值,该值指定要启动的实际应用程序(这绝不容易,是吗?),在这种情况下 ApplicationName 是一个对应用中资源的引用(我不知道如何读取这些值).

Modern applications will reference LaunchWinApp with a DelegateExecute value which specifies the actual application to launch (it's never easy, is it?), the ApplicationName in that case is a reference to a resource in the app (I have no idea how to read those values).

但是,为什么您要查找此信息 - 如果只是为了打开网页,那么您应该使用 Desktop API(从 java 1.6 开始)例如:

however, why are you looking for this information - if it's merely to open a web page, then you should use the Desktop API (since java 1.6) e.g.:

Desktop.getDesktop().browse(new URI("http://msn.com"));

粗略关于如何阅读支持特定网址方案的应用程序:

在 Windows 上,默认应用程序的控制权由 Default Programs 应用程序决定,该应用程序读取应用程序放置在注册表中的信息.

On Windows, the control of the default applications is determined by the Default Programs app, this app reads information that applications place in the registry.

操作系统在两个地方寻找已注册的应用程序:

There are two places the OS looks for registered applications:

HKEY_CURRENT_USER\SOFTWARE\RegisteredApplications

HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications

这些键下的条目引用到注册表中的相应位置,该位置与您正在查看的 ResisteredApplications 键的来源相同.

The entries under those keys are references to a corresponding location in the registry rooted under the same origin as the ResisteredApplications key you're looking at.

例如当您安装 firefox 时,它会在其中放置一个标记为 Firefox 的条目,其中包含值 Software\Clients\StartMenuInternet\FIREFOX.EXE\Capabilities.这是引用 HKEY_LOCAL_MACHINE\...\Capabilities.

e.g. when you install firefox, it places an entry in there labelled Firefox, containing the value Software\Clients\StartMenuInternet\FIREFOX.EXE\Capabilities. This is referencing HKEY_LOCAL_MACHINE\…\Capabilities.

当您查看该位置时,您将看到键 URLAssociations,它指定了它处理的 URL.当您同时看到 httphttps 值时,很可能这是一个网络浏览器.应用程序的名称应该可以从 Capabilities 键中的 ApplicationName 值中获得.这个键可以引用本地化名称,或者是它自己的本地化名称.从间接确定值并非易事(值得自己提出问题).

When you look under that location, you will see the key URLAssociations, which specifies the URLs that it handles. When you see both http and https Values, it makes it very likely that this is a web browser. The name of the applications should be obtainable from the ApplicationName value in the Capabilities key. This key can reference localized names, or be the localized name on it's own. Determining the value from an indirection is not trivial (would be worth it's own questions).

您可以从 url 的值(例如 http -> FirefoxURL)回溯到 HKEY_CLASSES_ROOT\FirefoxURL\Shell\Open\Command 以获取可执行文件,再次记住 new-ui 应用程序是一个特殊的案例.

You can backtrack from the url's value (e.g. http -> FirefoxURL) to a HKEY_CLASSES_ROOT\FirefoxURL\Shell\Open\Command to get an executable, again remembering that new-ui applications are a special case.

这篇关于如何通过 Windows 10 上的注册表找到默认浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 18:43