最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

CSS selector for bookmarked URLs? - Stack Overflow

programmeradmin4浏览0评论

I am assuming the answer will be "no" but figured I'd ask people more knowledgable than me.

Is there any sort of CSS selector for matching URLs that I have bookmarked in my browser? I see that I can use the psuedocass :visited for URLs in my browswer history, so I thought maybe there could be a structure that might work for URLs in my bookmarks but which might not be in history any longer.

I am assuming the answer will be "no" but figured I'd ask people more knowledgable than me.

Is there any sort of CSS selector for matching URLs that I have bookmarked in my browser? I see that I can use the psuedocass :visited for URLs in my browswer history, so I thought maybe there could be a structure that might work for URLs in my bookmarks but which might not be in history any longer.

Share Improve this question asked Mar 23 at 1:38 Crabgrass0899Crabgrass0899 2981 silver badge13 bronze badges 3
  • 1 I presume not because bookmarks are part of the user's browser, not part of the DOM. – rustyBucketBay Commented Mar 23 at 1:57
  • 1 There isn't, but I don't think there's any technical reason why browsers couldn't have such a pseudo-class. However, like :visited it would be extremely limited in what styling it could apply, since it for privacy reasons it any such styling would have to be undetectable by JavaScript. – Alohci Commented Mar 23 at 5:21
  • I think I'm going to just take the specific folder of bookmarks, do some regexing on them, and create my own local userstyle to match things like a[href="bookmarkURL1"], a[href="bookmarkURL2"] ... then try to manually update the list as new bookmarks are added. Seems to de-facto work even if it's a little sloppy. – Crabgrass0899 Commented Mar 23 at 23:12
Add a comment  | 

1 Answer 1

Reset to default 0

Bookmarks are not part of the DOM, they are only in the client's browser, therefore there is no CSS-selector to engage with in that way. There is also no way for javascript to connect properly to bookmarks in a user's browser (short of a browser extension), so you can't even really create a script that would be able to parse all the links in the page, compare it to the saved bookmarks, and add CSS to them, but then even if it were possible, that would be a heck of a script to write just to make a link look colourful.

发布评论

评论列表(0)

  1. 暂无评论