Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to client-side detect when a page is bookmarked?

Is it possible to detect when a page is bookmarked within the browser, using Javascript?

like image 421
Panagiotis Panagi Avatar asked Dec 06 '22 23:12

Panagiotis Panagi


2 Answers

No, AFAIK this is not possible.

like image 119
Darin Dimitrov Avatar answered Dec 09 '22 11:12

Darin Dimitrov


Most browsers will not let you detect when a page is bookmarked because this would be another vector for Browser History Mining exploits.

If malicious code could tell what websites you've used then, for example:

  1. At best, they'd know things about you that you might wish to keep private.
  2. They could use that information to target you with embarrassing ads or to target your kids with irresistible ads.
  3. They could target you with much more effective phishing attacks -- since they'd know services, banks, etc. you use online.

It is for this reason that the HTML spec has long required that:

The actual (history) entries are not accessible from script.

It follows that bookmarks are an even more lasting form of history, so they would not be allowed either.
Indeed whenever side-channel history-mining exploits (like the CSS :visited vulnerability) became known, the appropriate specs are adjusted and security-conscious browsers move to block the privacy hole.

like image 21
Brock Adams Avatar answered Dec 09 '22 13:12

Brock Adams