This is an archived tutorial from the kirupa.com legacy collection. It covers software that may no longer be available, but it is kept online because the ideas still hold up.
A popular feature you see on various sites is a link that allows you to bookmark their pages to your favorites. The following is an example of a link, when clicked, prompts you to add this page to your favorites:
|
|
Add to Favorites |
The Code:
javascript:window.external.AddFavorite(location.href, document.title);
The simplest way of implementing the JavaScript code would be to include it in a hyperlink. Copy and paste the following code into Notepad or your HTML editor and preview the page in your browser:
<html>
<head>
<title>kirupa.com</title>
</head>
<body>
<a href="javascript:window.external.AddFavorite(location.href, document.title);">
Add this Page to your Favorites</a>
</body>
</html>Basically, if you know how to create a hyperlink to a different page, you will be able to create a Add to Favorites link. There are a few simple characteristics that you should take note of:
This parameter gets the full URL of the current page.
This parameter takes note of the current page's title that will be used as your Favorites title.
The code I mentioned above works on any page and requires very little customization. The code will automatically determine the title of your page and the correct URL with no input required from you. There are, however, times when you do not want to have the current page's title and location added to your favorites. You may want to specify a specific page title and URL instead.
For such situations, use the following code instead:
javascript:window.external.AddFavorite('http://www.kirupa.com', 'kirupa.com')
The above code is very similar to the code posted earlier. The only difference is that the location.href and document.title parameters have been replaced with actual values that are independent of the page you are currently in.
I hope the information helped. If you have any questions or comments, please don't hesitate to post them on the kirupa.com Forums. Just post your question and I, or our friendly forum helpers, will help answer it.
The following is a list of related tutorial and help resources that you may find useful:
|
|
How to use the Forums |
|
|
New, Upcoming, and In-Progress Tutorials |
|
|
How to Help out kirupa.com |
|
|
Writing Tutorials |
| Cheers! | |
|
|
Kirupa Chinnathambi kirupaBlog |
Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence, ads, and algorithm-driven doodads. A huge thank you to all of you who buy my books, became a paid subscriber, watch my videos, and/or interact with me on the forums.
Your support keeps this site going! 😇

:: Copyright KIRUPA 2026 //--