Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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?

getBookmarkIdsForURI()

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

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top