Set as Home page
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 ("Hello, your browser does not support the auto-set page homepage feature, please manually set the page in the browser to the homepage!". \ n \ nyou need to manually set the ' +url+ ' to the home page. ");
}
}else{
Alert ("Hello, your browser does not support the auto-set page homepage feature, please manually set the page in the browser to the homepage!". \ n \ nyou need to manually set the ' +url+ ' to the home page. ");
}
}
}
Add to Favorites compatible with 360 and IE6
function Shoucang (Stitle,surl)
{
try{
Window.external.addFavorite (sURL, stitle);
}
catch (e) {
try{
Window.sidebar.addPanel (Stitle, sURL, "");
}
catch (e) {
Alert ("Add to collection failed, please use ctrl+d for adding");
}
}
}
<a href= "javascript:void (0)" onclick= "Sethome (this,window.location);" > Homepage </a>
<a href= "javascript:void (0)" onclick= "Shoucang (document.title,window.location)" > Add to Favorites </a>
This article is from the "Laiwenhua" blog, make sure to keep this source http://7883830.blog.51cto.com/7873830/1681829
Set homepage/Add to Favorites code