views:

194

answers:

4

I am adding bookmark from code. Now in Firefox if user already added the url as bookmark he should not be able to bookmark it again. How can I do it? For now every time a new bookmark is getting created.

A: 

As an alternative, try setting a cookie whenever the user bookmarks your site using your Javascript. If the cookie exists, remove the bookmark button (or whatever).

strager
+1  A: 

If you want to prevent people from clicking a bookmark link on your website for a second time, you could try to write using cookies to hide the link if there's a cookie on the client.

As far as I know trying to check the bookmarks library (Places) in FireFox by using javascript on your website, that is impossible.

Zaagmans
Yh. I will try that option if nothing easier found. :)
Tanmoy
+1  A: 

Obviously, you cannot, except for the above two good suggestions: use cookies. Or user information (although if they registered, they probably already bookmarked the site!). Cookie solution is brittle, though, as user can erase them.

Why you cannot: that would be an obvious security breach if a JavaScript program could read the list of bookmarks of the user: beside privacy concerns, one can have some sensible information in the URL parameters...

Side note: adding a bookmark is done on user action (or should be!). So users should know if they added the bookmark already, no?

PhiLho
sensitve (not sensible) right
DrG
Right. But what sometimes happens that user forgets that he has added it in his bookmarks. In IE it gives an alert that bookmark already present.
Tanmoy
But that's browser based. The website did not alert the user, IE did.
@in-spite: I confusedly felt the word was wrong! :-P Thanks for correcting. Sensible is actually the French word... :-)
PhiLho
+1  A: 

getBookmarkIdsForURI()

"This method retrieves the list of bookmark IDs that contain the given URI."

vartec
Does it need any library or something to add? If yes how to.
Tanmoy
Interesting, and good solution for the privacy issue. But that's for extensions only, no?
PhiLho