在IE中查询url协议处理程序的存在 [英] Query for url protocol handler existence in IE

查看:78
本文介绍了在IE中查询url协议处理程序的存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我正在寻找通过javascript查询我的自定义协议处理程序的不同方法,如果尚未安装,则优雅地重定向到安装页面。

I am looking at different methods of querying via javascript for the existence of my custom protocol handler, to gracefully redirect to install page if it's not already installed.

我现在正在研究三种不同的方法:

I am looking at three different methods as of now:

浏览器助手对象:这似乎是影响Internet Explorer的最有效方法,然而,对我的预期目的来说,这似乎有点矫枉过正。是否有一种更简单的方法来制作IE"插件",或者任何易于使用的引用聚焦
来向客户端脚本提供信息?我打算用我的URL处理程序安装这个插件,所以如果我的插件存在,我知道我的URL处理程序存在。是为每个页面动态加载插件还是用户需要重新启动IE?

Browser Helper Object: This seems to be the most powerful way to affect Internet Explorer, however it also seems a bit overkill for my intended purpose. Is there either an easier way of making IE "plugins", or any easy to use references focusing on providing information to client-side scripting? I am planning to install this plugin with my URL handler, so if my plugin exists I know that my URL handler exists. Is the plugin loaded dynamically for each page or would the user need to restart IE?

用户代理字符串:这似乎是一种更简单的解决方案,但我无法让它工作。我在HKEY_LOCAL_MACHINE \ SOFTWARE \ Microoft \ Windows \ CurrentVersion \Internet Settings \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\以任何方式影响用户代理字符串,即使字符串中的该键下的其他字符串值可用。即使我重新启动IE甚至我的电脑,它仍然没有去。难道我做错了什么?另外,我是否需要重新启动IE以使更改
最终工作?

User agent string: This seems a way simpler solution, but I cannot get it to work. I've added a string value under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform with a certain name but this does not seem to affect the user agent string in any way, even though other string values under that key is available in the string. Even if I restart IE or even my computer it's still no go. Am I doing something wrong? Also, do I need to restart IE for the change to work in the end?

protocolLong属性:我看到某些黑客尝试使用protocolLong属性来确定是否已安装处理程序。我收集这应该返回注册协议的描述字符串。但是,即使我可以使用链接打开我的应用程序
,该相同的链接也会返回"未知协议"。来自protocolLong属性。我怎么能注册一个描述?我已经看到绝对没有关于谷歌的信息。

protocolLong property: I have seen certain hacks that try to use the protocolLong property to determine if a handler is installed. I gather this is supposed to return a description string of the registered protocol. However, even though I can open my application using a link, that same link returns "Unknown protocol" from the protocolLong property. How could I register a description? I have seen absolutely no information about this using google.

你会推荐哪种方法?我宁愿不必重新启动Internet Explorer,因为它会破坏用户体验。

Which approach would you recommend? I'd rather not have to restart internet explorer because it ruins the user experience.

推荐答案

在扩展开发论坛中重新发布
http://social.msdn.microsoft。 com /论坛/ en / ieextensiondevelopment / threads

Repost in the Extension Development forum http://social.msdn.microsoft.com/Forums/en/ieextensiondevelopment/threads

您需要从Cab文件安装。在客户端,您放置一个< object>标记在具有协议处理程序/ ActiveX的CLSID的页面中。您可以像检测ActiveX一样检测并安装它。

You will need to install from a Cab file. On the client side you place an <object> tag in a page that has the CLSID of your Protocol Handler/ActiveX. You detect and install it as you would an ActiveX.

不要使用userAgent字符串....(IE9不会在请求标头中发送任何第三方令牌)

DO NOT USE the userAgent string....(IE9 does not send any third party tokens in the request header)

或者,您可以在注册表HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft Office \ Internet Explorer \Version Vector

Alternatively you can add a token to the IE Version vector in the registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version Vector

中向IE版本向量添加令牌,然后使用在您的页面上有条件的评论以查看它是否已安装以及最低版本。

and then use conditional comments on your pages to see if it is installed and the latwst version.

查看我的实现
http://www.iecustomizer.com/Downloads/IECTools/UpdateCheck.aspx

<table width="100%" style="width:100%" summary="">
<tbody>
  <tr>
    <th align="center" style="text-align:center"><p>Update Check</p></th>
  </tr>
  <tr>
    <td>
      <div id="divIEShortcuts"></div>
    </td>
  </tr>
  <tr>
    <td>
      <div id="divIETheme"></div>
    </td>
  </tr>
  <tr>
    <td>
      <div id="divIEStyles"></div>
    </td>
  </tr>
  <tr>
    <td>
      <div id="divIEMenus"></div>
    </td>
  </tr>
  <tr>
    <td>
      <div id="divIEButtons"></div>
    </td>
  </tr>
  <tr>
    <td>
      <div id="divIESearches"></div>
    </td>
  </tr>
  <tr>
    <td>
      <div id="divIESideBars"></div>
    </td>
  </tr>
  <tr>
    <td>
      <div id="divDocX"></div>
    </td>
  </tr>
</tbody>
</table>
<!--[if lt DocX 7.0001]>
  <script type="text/javascript">
    g_DocX = 1;
  </script>
<![endif]-->
<!--[if DocX 7.0001]>
  <script type="text/javascript">
    g_DocX = 9;
  </script>
<![endif]-->
<!--[if !DocX ]>
  <script type="text/javascript">
    g_DocX = 0;
  </script>
<![endif]-->

<!--[if lt IESideBars 7.0001]>
  <script type="text/javascript">
    g_IESideBars = 1;
  </script>
<![endif]-->
<!--[if IESideBars 7.0001]>
  <script type="text/javascript">
    g_IESideBars = 9;
  </script>
<![endif]-->
<!--[if !IESideBars ]>
  <script type="text/javascript">
    g_IESideBars = 0;
  </script>
<![endif]-->

<!--[if lt IESearches 7.0001]>
  <script type="text/javascript">
    g_IESearches = 1;
  </script>
<![endif]-->
<!--[if IESearches 7.0001]>
  <script type="text/javascript">
    g_IESearches = 9;
  </script>
<![endif]-->
<!--[if !IESearches ]>
  <script type="text/javascript">
    g_IESearches = 0;
  </script>
<![endif]-->

<!--[if lt IEButtons 7.0003]>
  <script type="text/javascript">
    g_IEButtons = 1;
  </script>
<![endif]-->
<!--[if IEButtons 7.0003]>
  <script type="text/javascript">
    g_IEButtons = 9;
  </script>
<![endif]-->
<!--[if !IEButtons ]>
  <script type="text/javascript">
    g_IEButtons = 0;
  </script>
<![endif]-->

<!--[if lt IEMenus 7.0004]>
  <script type="text/javascript">
    g_IEMenus = 1;
  </script>
<![endif]-->
<!--[if IEMenus 7.0004]>
  <script type="text/javascript">
    g_IEMenus = 9;
  </script>
<![endif]-->
<!--[if !IEMenus ]>
  <script type="text/javascript">
    g_IEMenus = 0;
  </script>
<![endif]-->

<!--[if lt IEStyles 7.0003]>
  <script type="text/javascript">
    g_IEStyles = 1;
  </script>
<![endif]-->
<!--[if IEStyles 7.0003]>
  <script type="text/javascript">
    g_IEStyles = 9;
  </script>
<![endif]-->
<!--[if !IEStyles ]>
  <script type="text/javascript">
    g_IEStyles = 0;
  </script>
<![endif]-->

<!--[if lt IETheme 7.0004]>
  <script type="text/javascript">
    g_IETheme = 1;
  </script>
<![endif]-->
<!--[if IETheme 7.0004]>
  <script type="text/javascript">
    g_IETheme = 9;
  </script>
<![endif]-->
<!--[if !IETheme ]>
  <script type="text/javascript">
    g_IETheme = 0;
  </script>
<![endif]-->

<!--[if lt IEShortcuts 7.0003]>
  <script type="text/javascript">
    g_IEShortcuts = 1;
  </script>
<![endif]-->
<!--[if IEShortcuts 7.0003]>
  <script type="text/javascript">
    g_IEShortcuts = 9;
  </script>
<![endif]-->
<!--[if !IEShortcuts ]>
  <script type="text/javascript">
    g_IEShortcuts = 0;
  </script>
<![endif]-->

<script type="text/javascript">
  var sbuf = '';
  if (g_DocX == 0) {
    sbuf = '<p>You don\'t have <span class=\"bold\">Deviner Tools<\/span> Context Menus installed on your computer yet!<\/p>';
    sbuf += '<p>Download and install it <a href=\"DevinerTools.aspx\">here<\/a>.<\/p>';
    document.getElementById('divDocX').innerHTML = sbuf;
  }
  else if (g_DocX == 9) {
    sbuf = '<p>You have the latest version of <span class=\"bold\">Deviner Tools<\/span> Context Menus installed on your computer.<\/p>';
    sbuf += '<p>No Updates are available at this time.<\/p>';
    document.getElementById('divDocX').innerHTML = sbuf;
  }
  else {
    sbuf = '<p>An update for <span class=\"bold\">Deviner Tools<\/span> Context Menus is available<\/p>';
    sbuf += '<p>You can download and install it <a href=\"DevinerTools.aspx\">here<\/a>.<\/p>';
    document.getElementById('divDocX').innerHTML = sbuf;
  }

  if (g_IESideBars == 0) {
    sbuf = '<p>You don\'t have <span class=\"bold\">SideBars Manager<\/span> installed on your computer yet!<\/p>';
    sbuf += '<p>Download and install it <a href=\"SideBarsManagerHome.aspx\">here<\/a>.<\/p>';
    document.getElementById('divIESideBars').innerHTML = sbuf;
  }
  else if (g_IESideBars == 9) {
  sbuf = '<p>You have the latest version of <span class=\"bold\">SideBars Manager<\/span> installed on your computer.<\/p>';
    sbuf += '<p>No Updates are available at this time.<\/p>';
    document.getElementById('divIESideBars').innerHTML = sbuf;
  }
  else {
    sbuf = '<p>An update for <span class=\"bold\">SideBars Manager<\/span> is available<\/p>';
    sbuf += '<p>You can download and install it <a href=\"SideBarsManagerHome.aspx\">here<\/a>.<\/p>';
    document.getElementById('divIESideBars').innerHTML = sbuf;
  }

  if (g_IESearches == 0) {
    sbuf = '<p>You don\'t have <span class=\"bold\">Search Manager<\/span> installed on your computer yet!<\/p>';
    sbuf += '<p>Download and install it <a href=\"SearchManagerHome.aspx\">here<\/a>.<\/p>';
    document.getElementById('divIESearches').innerHTML = sbuf;
  }
  else if (g_IESearches == 9) {
  sbuf = '<p>You have the latest version of <span class=\"bold\">Search Manager<\/span> installed on your computer.<\/p>';
    sbuf += '<p>No Updates are available at this time.<\/p>';
    document.getElementById('divIESearches').innerHTML = sbuf;
  }
  else {
    sbuf = '<p>An update for <span class=\"bold\">Search Manager<\/span> is available<\/p>';
    sbuf += '<p>You can download and install it <a href=\"SearchManagerHome.aspx\">here<\/a>.<\/p>';
    document.getElementById('divIESearches').innerHTML = sbuf;
  }

  if (g_IEButtons == 0) {
    sbuf = '<p>You don\'t have <span class=\"bold\">Buttons Manager<\/span> installed on your computer yet!<\/p>';
    sbuf += '<p>Download and install it <a href=\"ButtonsManagerHome.aspx\">here<\/a>.<\/p>';
    document.getElementById('divIEButtons').innerHTML = sbuf;
  }
  else if (g_IEButtons == 9) {
    sbuf = '<p>You have the latest version of <span class=\"bold\">Buttons Manager<\/span> installed on your computer.<\/p>';
    sbuf += '<p>No Updates are available at this time.<\/p>';
    document.getElementById('divIEButtons').innerHTML = sbuf;
  }
  else {
    sbuf = '<p>An update for <span class=\"bold\">Buttons Manager<\/span> is available<\/p>';
    sbuf += '<p>You can download and install it <a href=\"ButtonsManagerHome.aspx\">here<\/a>.<\/p>';
    document.getElementById('divIEButtons').innerHTML = sbuf;
  }

  if (g_IEMenus == 0) {
    sbuf = '<p>You don\'t have <span class=\"bold\">Menus Manager<\/span> installed on your computer yet!<\/p>';
    sbuf += '<p>Download and install it <a href=\"IEMenusHome.aspx\">here<\/a>.<\/p>';
    document.getElementById('divIEMenus').innerHTML = sbuf;
  }
  else if (g_IEMenus == 9) {
    sbuf = '<p>You have the latest version of <span class=\"bold\">Menus Manager<\/span> installed on your computer.<\/p>';
    sbuf += '<p>No Updates are available at this time.<\/p>';
    document.getElementById('divIEMenus').innerHTML = sbuf;
  }
  else {
    sbuf = '<p>An update for <span class=\"bold\">Menus Manager<\/span> is available<\/p>';
    sbuf += '<p>You can download and install it <a href=\"IEMenusHome.aspx\">here<\/a>.<\/p>';
    document.getElementById('divIEMenus').innerHTML = sbuf;
  }

  if (g_IEStyles == 0) {
    sbuf = '<p>You don\'t have <span class=\"bold\">Styles Manager<\/span> installed on your computer yet!<\/p>';
    sbuf += '<p>Download and install it <a href=\"StylesManagerHome.aspx\">here<\/a>.<\/p>';
    document.getElementById('divIEStyles').innerHTML = sbuf;
  }
  else if (g_IEStyles == 9) {
    sbuf = '<p>You have the latest version of <span class=\"bold\">Styles Manager<\/span> installed on your computer.<\/p>';
    sbuf += '<p>No Updates are available at this time.<\/p>';
    document.getElementById('divIEStyles').innerHTML = sbuf;
  }
  else {
    sbuf = '<p>An update for <span class=\"bold\">Styles Manager<\/span> is available<\/p>';
    sbuf += '<p>You can download and install it <a href=\"StylesManagerHome.aspx\">here<\/a>.<\/p>';
    document.getElementById('divIEStyles').innerHTML = sbuf;
  }

  if (g_IETheme == 0) {
    sbuf = '<p>You don\'t have <span class=\"bold\">Themes Manager<\/span> installed on your computer yet!<\/p>';
    sbuf += '<p>Download and install it <a href=\"ThemesManagerHome.aspx\">here<\/a>.<\/p>';
    document.getElementById('divIETheme').innerHTML = sbuf;
  }
  else if (g_IETheme == 9) {
    sbuf = '<p>You have the latest version of <span class=\"bold\">Themes Manager<\/span> installed on your computer.<\/p>';
    sbuf += '<p>No Updates are available at this time.<\/p>';
    document.getElementById('divIETheme').innerHTML = sbuf;
  }
  else {
    sbuf = '<p>An update for <span class=\"bold\">Themes Manager<\/span> is available<\/p>';
    sbuf += '<p>You can download and install it <a href=\"ThemesManager.aspx\">here<\/a>.<\/p>';
    document.getElementById('divIETheme').innerHTML = sbuf;
  }

  if (g_IEShortcuts == 0) {
    sbuf = '<p>You don\'t have <span class=\"bold\">Address Bar Shortcuts Manager<\/span> installed on your computer yet!<\/p>';
    sbuf += '<p>Download and install it <a href=\"SearchURLsManagerHome.aspx\">here<\/a>.<\/p>';
    document.getElementById('divIEShortcuts').innerHTML = sbuf;
  }
  else if (g_IEShortcuts == 9) {
  sbuf = '<p>You have the latest version of <span class=\"bold\">Address Bar Shortcuts Manager<\/span> installed on your computer.<\/p>';
    sbuf += '<p>No Updates are available at this time.<\/p>';
    document.getElementById('divIEShortcuts').innerHTML = sbuf;
  }
  else {
    sbuf = '<p>An update for <span class=\"bold\">Address Bar Shortcuts Manager<\/span> is available<\/p>';
    sbuf += '<p>You can download and install it <a href=\"SearchURLsManagerHome.aspx\">here<\/a>.<\/p>';
    document.getElementById('divIEShortcuts').innerHTML = sbuf;
  }

</script>

此方法在Eric Lawerence的IEInternals博客中有解释....(找不到目前的链接)。

this method was explained in Eric Lawerence's IEInternals blog.... (can't find the link at the moment).

问候。


这篇关于在IE中查询url协议处理程序的存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆