Monday, June 3, 2024
13
rated 0 times [  17] [ 4]  / answers: 1 / hits: 199036  / 14 Years ago, fri, june 11, 2010, 12:00:00

Is there any cross-browser bookmark/add to favorites using JavaScript.



Searched for some list but none is working. Can you please suggest any?


More From » cross-browser

 Answers
1

jQuery Version


JavaScript (modified from a script I found on someone's site - I just can't find the site again, so I can't give the person credit):


$(document).ready(function() {
$("#bookmarkme").click(function() {
if (window.sidebar) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(location.href,document.title,"");
} else if(window.external) { // IE Favorite
window.external.AddFavorite(location.href,document.title); }
else if(window.opera && window.print) { // Opera Hotlist
this.title=document.title;
return true;
}
});
});

HTML:


<a id="bookmarkme" href="#" rel="sidebar" title="bookmark this page">Bookmark This Page</a>

IE will show an error if you don't run it off a server (it doesn't allow JavaScript bookmarks via JavaScript when viewing it as a file://...).


[#96529] Tuesday, June 8, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eliezerc

Total Points: 286
Total Questions: 102
Total Answers: 102

Location: Federated States of Micronesia
Member since Sun, May 16, 2021
3 Years ago
eliezerc questions
Mon, Jun 20, 22, 00:00, 2 Years ago
Fri, Sep 4, 20, 00:00, 4 Years ago
Fri, Jul 3, 20, 00:00, 4 Years ago
;