<!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> <title>lilac~test</title> <script type="text/javascript"> function setHomepage() { if (document.all) { document.body.style.behavior='url(#default#homepage)'; document.body.setHomePage('http://www.csdn.net'); } else if (window.sidebar) { if(window.netscape) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); } catch (e) { alert("this action was aviod by your browser,if you want to enable,please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true"); } } var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch); prefs.setCharPref('browser.startup.homepage','http://www.csdn.net'); } } </script> </head> <body> <input type="button" value="设为首页" onclick="return setHomepage();" /> </body> </html>提示的是:该操作被浏览器拒绝,如果想启用该功能,请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>lilac~test</title>
<script type="text/javascript">
function setHomepage()
{
if (document.all)
{
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage('http://www.csdn.net'); }
else if (window.sidebar)
{
if(window.netscape)
{
try
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}
catch (e)
{
alert("this action was aviod by your browser,if you want to enable,please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");
}
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage','http://www.csdn.net');
}
}
</script>
</head>
<body>
<input type="button" value="设为首页" onclick="return setHomepage();" />
</body>
</html>提示的是:该操作被浏览器拒绝,如果想启用该功能,请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true
是好用的啊
你有照着上面说的改么~如果在火狐浏览器里运行,会提示"这样可能会失去质保!
修改这些高级设置可能会对本应用的稳定性、安全性以及性能造成不良影响。请仅在您十分清楚的情况下继续操作。"
这段话,下面还有个按钮“我保证会小心”
点击 会出现firefox的高级设置
在过滤器里输入"signed"即可,下面就仅剩一项了,然后鼠标双击选项,值修改为"true".
然后重新在地址栏里输入你的url,那段脚本就可使用了如果还不明白,我就给你截图好了
http://www.jsweb8.cn/html/js_system/916.htm