JS: Add favorites/set the default homepage

Source: Internet
Author: User

Add to favorites

<HTML>

<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Title> webpage special effects | www.jscode.cn | --- add to favorites </title>
</Head>

<Body>
Right-click to view code

<P> code 1: <a onclick = "window. external. addFavorite (location. href, document. title); "Title =" webpage effects "style =" cursor: Hand "> Add this page to favorites </a> </P>
<P> <br>

Code 2: <a href = "javascript: window. External. AddFavorite ('HTTP: // www.jscode.cn ', 'webpage effect exclusive')"> Add to favorites </a>

</P>
<P>
<Script language = "JavaScript">
Function AddFavorite (URL, title ){
VaR fav_url = URL;
VaR fav_title = title;
If (document. All & window. External ){
Window. External. AddFavorite (fav_url, fav_title );
} Else if (window. Sidebar ){
Window. Sidebar. addpanel (fav_title, fav_url ,"");
} Else {
Alert ("not supported by browsers, please manually add to Favorites ");
}
}
</SCRIPT>
Code 3: <a href = "javascript: AddFavorite ('HTTP: // www.html.org.cn ', 'website title');"> Add to favorites </a>
</P>
</Body>

</Html>

Set the default homepage
<HTML>

<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Title> webpage effects | www.jscode.cn | --- set the default homepage </title>
</Head>

<Body>
Right-click to view code

<P> code 1: <span onclick = "Var strhref = Window. location. href; this. style. behavior = 'url (# default # homepage) '; this. setHomePage ('HTTP: // www.jscode.cn '); "style =" cursor: Hand "> set this site as the homepage </a> </span> </P>
<P> <br>

Code 2: <a Title = "set this site as the browser Homepage" onclick = "this. style. behavior = 'url (# default # homepage) '; this. setHomePage ('HTTP: // www.jscode.cn '); "href =" javascript:; "> set as homepage </a>

</P>

</Body>

</Html>

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.