DBMNG数据库管理与应用

才能是来自独创性。独创性是思维、观察、理解和判断的一种独特的方式。
当前位置:首页 > 经验分享 > Javascript

window.external.addFavorite使用JS添加网址到收藏夹时提示"找不到元素"的解决办法

加入收藏 

js文件:

<script type="text/javascript">

function addFav(){
                    var url = window.location;
                    var title = $('#savemynet').attr("title");
                    try{
                        window.external.addFavorite(url, title);
                      }catch (e){
                      try{
                        window.sidebar.addPanel(title, url, "");
                      }catch (e){
                        alert("加入收藏失败,您可以尝试通过快捷键 ctrl + D 加入到收藏夹~");
                      }
                      }
                    }

<script>


Html代码:

<a style="cursor:pointer;" onClick="addFav()" title="${corpinfo.scorpname}" id="savemynet" >收藏本公司</a>

1.<a href="#" onclick="javascript:window.external.AddFavorite('网址','网站标题')" title="收藏本站到你的收藏夹">加入收藏</a> 
<a href="#" onclick="javascript:window.external.AddFavorite('网址','网站标题')" title="收藏本站到你的收藏夹">加入收藏</a>
在IE7浏览器下,在网站中使用以上代码或者相类似方法添加网址到收藏夹的时候提示“找不到元素”,而在另一台电脑的浏览器中使用就没有任何问题。

解决方法如下:

1. 点击“开始”-“运行”,输入“regedit”,点击“确定”,打开“注册表编辑器”。

2. 找到 HKEY_CLASSES_ROOT\TypeLib\{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}\1.1\0\win32 ,将右侧“默认”值的数据"C:\WINDOWS\system32\shdocvw.dll" 改为 "C:\WINDOWS\system32\ieframe.dll" 。

3. 重新启动浏览器,以上程序工作正常。

 

以下为此文翻译前的英文原文:

GWT not working on Internet explorer 7 (IE7) giving "Element not found" javascript error

GWT web application started to give "Element not found" javascript error message on Internet Explorer 7 (IE7)? This application worked fine on Internet Explorer 6 and Firefox 2. Now your best guess would be; GWT not working on IE 7 properly. Wasn't it?

But the scenario became confusing and unbelievable because your application worked fine on IE7 in some machines while not on some others. Have you faced this issue? Then the below solution is for you.

This issue can be fixed by a making a change on windows registry.

Steps to follow are;

1. Open up the Registry editor - type regedit on command prompt.

2. Look for the key shown below

HKEY_CLASSES_ROOT\TypeLib\{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}\1.1\0\win32

3. Click on the "Default" row and see the value there. If it's value is "C:\WINDOWS\system32\shdocvw.dll", then that is what causes the above mentioned issue. If you have installed Windows in a different drive; C:\ must be replaced with the that letter.

4. Replace that value with "C:\WINDOWS\system32\ieframe.dll".

5. Now restart IE7, and load your GWT application.

本站文章内容,部分来自于互联网,若侵犯了您的权益,请致邮件chuanghui423#sohu.com(请将#换为@)联系,我们会尽快核实后删除。
Copyright © 2006-2023 DBMNG.COM All Rights Reserved. Powered by DEVSOARTECH            豫ICP备11002312号-2

豫公网安备 41010502002439号