tags:

views:

96

answers:

4

Is there a simple way to create a link that does either?

Basically, I would like a very simple way to do this. Any suggestions are helpful.

UPDATE: Thanks for the responses! Does anyone know how to make a page their homepage using javascript?

+3  A: 

In just IE:

<a href="javascript:window.external.AddFavorite('http://mysite.com', 'My Site')">Bookmark This Site</a>

In firefox and IE:

function addBookmark(title, url) {
        if (window.sidebar) { // firefox
              window.sidebar.addPanel(title, url,"");
        } else if( document.all ) { //MSIE
                window.external.AddFavorite( url, title);
        } else {
               alert("Sorry, your browser doesn't support this");
        }
}

<a href="javascript:addBookmark('My Site','http://www.mysite.com')&gt;Add bookmark</a>
karim79
+1  A: 

Check this for adding the site to the user's bookmarks

fmartin
A: 

There are ways to add favorites using Javascript, although some browsers don't support it at all. You can find a script here that claims to offer a cross-browser method of adding a bookmark, but actually just tells the user what to press to open the Add Bookmark dialog on Firefox, for example.

In all cases, all that javascript can do is open the add bookmark dialog, and the user will still have to manually add the bookmark themselves.

Daniel Vandersluis
A: 

You can use this code to set your page as the user's homepage.

fmartin