html+js 设为首页 完全兼容IE

来源:互联网 发布:单兵数字侦察软件 编辑:程序博客网 时间:2024/06/06 01:19
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>test</title> <script type="text/javascript"> function SetHome(obj, url) {            try {                obj.style.behavior = 'url(#default#homepage)';                obj.setHomePage(url);            } catch (e) {                if (window.netscape) {                    try {                        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");                    } catch (e) {                        alert("抱歉,此操作被浏览器拒绝!\n\n请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为'true'");                    }                } else {                    alert("抱歉,您所使用的浏览器无法完成此操作。\n\n您需要手动将【" + url + "】设置为首页。");                }            }        }</script></head> <body> <a title="设为首页" onclick="SetHome(this,'http://www.testurl.com/')" href="javascript:void();">设为首页</a></body> </html>

菜鸟总结 多存疏漏 感谢指正

0 0
原创粉丝点击