永发信息网

在HTML如何修改代码以达到在点击超链接时默认以IE浏览器打开?

答案:3  悬赏:0  手机版
解决时间 2021-11-24 12:44
  • 提问者网友:暗中人
  • 2021-11-23 20:57
因为现在浏览器很多,导致一些我想实现的功能无法实现。如果我想实现默认以IE浏览器打开一个链接,但是不影响其他浏览器为默认浏览器的设置。
最佳答案
  • 五星知识达人网友:拾荒鲤
  • 2019-01-26 15:23
1. “工具”→“Internet选项”,在打开的窗口中选择“程序”选项卡,然后勾选“检查Internet Explorer是否为默认浏览器”,最后单击“确定”。

这样就可以了啊。

为什么要在代码里面修改呢?

2. C#里面是可以的修改的

/// <summary>
/// 恢复IE为默认浏览器
/// </summary>
/// <returns></returns>
public static bool ResetIEDefaultBrowser()
{
string mainKey = @"http\shell\open\command";
string nameKey = @"http\shell\open\ddeexec\Application";
string IEPath = @"C:\Program Files\Internet Explorer\iexplore.exe";
bool result = false;

try
{
string value = string.Format("\"{0}\" -- \"%1\"", IEPath);
RegistryKey regKey = Registry.ClassesRoot.OpenSubKey(mainKey, true);
regKey.SetValue("", value);
regKey.Close();

regKey = Registry.ClassesRoot.OpenSubKey(nameKey, true);
regKey.SetValue("", "IExplore");
regKey.Close();

result = true;
}
catch
{
}

return result;
全部回答
  • 1楼网友:鱼芗
  • 2018-12-15 13:21
这个应该是你在装浏览器的时候选择的默认浏览器设置,跟在HTML里写代码无关
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯