问题
When i click on a custom link such as foo:\ , and there is already a registered protocol handler on windows machine, Internet explorer or Edge display a warning before allowing user to run the custom protocol handler, but if the user select to not display this warning again, the Internet explore(Edge) run the protocol handler without displaying the warning. My question is how reset my selection again and make Internet Explorer or Edge display the warning again.
回答1:
If the name of your protocol is foo, then you can update the registry with the following:
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\ProtocolExecute\foo]
"WarnOnOpen"=dword:00000001
Will enable it
and
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\ProtocolExecute\foo]
"WarnOnOpen"=dword:00000000
will disable it
回答2:
To add on Raj Rao answer: use instead HKEY_LOCAL_MACHINE**\SOFTWARE\Microsoft\Internet Explorer\ProtocolExecute
to install your protocol for all users.
回答3:
Revert the changes triggered by overriding the protocol handler by finding the event and reverting the state changes to their defaults:
After updating the registry keys, the program should broadcast the WM_SETTINGCHANGE message with wParam = 0 and lParam pointing to the null-terminated string "Software\Clients\ClientTypeName" to notify the operating system that the default client has changed.
In HKEY_CLASSES_ROOT
, revert the default data of the protocol in question.
This registry hierarchy replaces the existing mailto registry hierarchy found at HKEY_CLASSES_ROOT\mailto. The hierarchy remains the same, only the location has changed.
References
Registering an Application to a URI Scheme (Windows)
Registering Programs with Client Types (Windows)
WM_SETTINGCHANGE message (Windows)
Windows registry information for advanced users
How to suppress or display a warning message when users try to save a file in OpenDocument Format (ODF) in Office 2010 or the 2007 Office suite Service Pack 2
You are prompted to specify Internet Explorer when you click a link in Outlook 2010 or Outlook 2007
Windows registry information for advanced users
If you don’t want the changes to be permanent, the don’t pass the flag that says that you want the changes to be permanent – The Old New Thing
来源:https://stackoverflow.com/questions/37702082/internet-explorer-or-edge-how-to-display-the-warning-that-appear-if-you-open-c