Set homepage/Add to Favorites code

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.