Home  >  Article  >  php教程  >  设为首页and加入收藏

设为首页and加入收藏

WBOY
WBOYOriginal
2016-06-07 11:44:431549browse

设为首页and加入收藏js
function addFavorite() {<br>     if(document.all) {<br>         try {<br>             window.external.addFavorite(window.location.href, document.title);<br>         } catch(e) {<br>             alert("加入收藏失败,请使用Ctrl+D进行添加");<br>         }<br>     } else if(window.sidebar) {<br>         window.sidebar.addPanel(document.title, window.location.href, "");<br>     } else {<br>         alert("加入收藏失败,请使用Ctrl+D进行添加");<br>     }<br> }<br> function setHomepage() {<br>     if(document.all) {<br>         document.body.style.behavior = 'url(#default#homepage)';<br>         document.body.setHomePage(window.location.href);<br>     } else if(window.sidebar) {<br>         if(window.netscape) {<br>             try {<br>                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");<br>             } catch(e) {<br>                 alert("该操作被浏览器拒绝,如果想启用该功能,请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");<br>             }<br>         }<br>         var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);<br>         prefs.setCharPref('browser.startup.homepage', window.location.href);<br>     } else {<br>         alert('您的浏览器不支持自动自动设置首页, 请使用浏览器菜单手动设置!');<br>     }<br> }

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn