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

血红的双手。 提交于 2019-12-01 10:58:35

No, AFAIK this is not possible.

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.

you could try detect key combinations at least, ctrl+d etc etc

I found this question when searching for something similar. Here's how I'm doing it:

When the user uses one of the awesome features of the site I run this code

var bm=confirm("How great is this site? Would you like to bookmark it?");
if (bm==true){
  window.external.AddFavorite(location.href,document.title);
  // and then don't show this again and record that they bookmarked
}

The beautiful part is I'll keep bugging the user to bookmark the page until they do...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!