Wednesday, May 1, 2013

Add Bookmark in Website using JavaScript in ASP.NET


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.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
    <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, "");
<h3>Add Bookmark in Web Site using javaScript</h3>
    <a href="javascript:Bookmark();">Bookmark this page!</a>
Output 1
Click on "Bookmark this page" link
Output 2
enter any name and then save in favorites list.