Inroduction
In this article I will explain
how to add bookmark in website using JavaScript in ASP.NET.
we will see link like “Bookmark this Site” in many websites. if we click on this
link that will prompts the user with dialog box to add that specified link in
favorites list. If we want to add that type functionality in our website then
use following code.
Coding
Add_Bookmark.htm
<!DOCTYPE
html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script
language="javascript"
type="text/javascript">
function Bookmark()
{
title =
document.title;
url =
document.URL;
if (document.all)
//For IE
window.external.AddFavorite(url, title)
else if (window.sidebar)
//For Mozilla
{
window.sidebar.addPanel(title, url, "");
}
}
</script>
</head>
<body>
<h3>Add
Bookmark in Web Site using javaScript</h3>
<div>
<a href="javascript:Bookmark();">Bookmark
this page!</a>
</div>
</body>
</html>
Output 1
Click on "Bookmark this page" link
Output 2
enter any name and then save in
favorites list.
No comments:
Post a Comment