---
title: "java IE火狐兼容添加到收藏夹 IE7浏览器状态栏报错,\"找不到元素\"或者\"没有权限\""
author: "duyunfengsolo"
date: "2010-03-08T11:58:25Z"
tags: []
categories: ["Web前端"]
slug: "java-ie-ie7"
draft: false
lastmod: "2010-03-08T11:58:25Z"
id: 610075
url: "https://solodu.iteye.com/blog/610075"
---

```
java IE火狐兼容添加到收藏夹的java代码：
function addToBookmark() {
	var url = document.location.href;
	if(window.sidebar){
		window.sidebar.addPanel("MonsterBig", url,""); 
	}else if(document.all){
		window.external.addFavorite(url, "MonsterBig");
	}else if(window.opera && window.print){
		return true;
	}		
}
```

 上面的代码是正确的。至于碰到的浏览器报告错误是：

(1)浏览器状态栏会报没有权限的错误：

          原因是：如果该页面没有放在服务器（如tomcat）上 ，而是放在普通文件夹中（如桌面），则浏览器状态栏会报没有权限的错误。

(2)IE7浏览器状态栏报错，“找不到元素”的错误：

          原因是注册表的问题了。

          修改如下注册表信息：

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.

 

这样修改好后，然后再把这个程序放到tomcat服务器里面就可以搞定问题了。

3和4说的意思是：如果值里面是：C:\\WINDOWS\\system32\\shdocvw.dll 就把它用C:\\WINDOWS\\system32\\ieframe.dll 替换掉就可以了。