2

I am trying to create a hyperlink that, when clicked, will prompt the user to add the current page to their browser's favorites.

I have been unable to find a clear-cut answer to this question, or an answer that was posted to the Internet less than 7 years ago that still works.

How is this done?

MultiDev
  • 10,389
  • 24
  • 81
  • 148
  • http://stackoverflow.com/questions/3024745/cross-browser-bookmark-add-to-favorites-javascript ? – d-_-b Dec 17 '12 at 00:10
  • That is not working in Safari – MultiDev Dec 17 '12 at 00:14
  • 2
    That's because Safari and Chrome don't support it. You can modify the code in the link @iight posted to show a message to Chrome and Safari users telling them to press ctrl+D – Enrico Dec 17 '12 at 00:23
  • I think it'll really come down to why and how you want this done. (i wish i knew how to italicize in comments...) – d-_-b Dec 17 '12 at 00:25
  • 2
    @iight \*italicized\* like *this*. Do I get points? – Enrico Dec 17 '12 at 00:27
  • I just want an "add to favorites" button that is supported in all major browsers (IE, Firefox, Chrome, Safari, Opera, Etc) – MultiDev Dec 17 '12 at 00:28
  • @Enrico: Indeed, and it's not supported in current versions of Firefox either. Adding bookmarks from Javascript is on its way out, if it's not gone already; at this point I think the only browsers that *do* support it are some versions of Internet Explorer. –  Dec 17 '12 at 00:28
  • Ya there's no reason to circumvent the Browser... But that could change based on your application.... As @duskwuff said, It's on Its way out....enrico, best I can do is upvote! Thanks – d-_-b Dec 17 '12 at 00:56
  • @light, when you use ***comment box*** you can press the ***blue help link*** to see formatting tips like [links](http://stackoverflow.com/q/13906790/1195891), *italic*, **bold**, and `code`. – arttronics Dec 17 '12 at 02:44

1 Answers1

1

I have been unable to find a clear-cut answer to this question, or an answer that was posted to the Internet less than 7 years ago that still works.

How is this for clear cut... you can't.

7 years ago, various browsers supported various ways (some hacks, some official) to add bookmarks using javascript. However, as duskwuff mentioned, support for this functionality is on the way out - maybe because it was little used, maybe because it is a security issue.

Enrico
  • 10,377
  • 8
  • 44
  • 55