bithappens / copy-link-bookmarklet

Bookmarklets for copying a link to the currently open page in various formats.
https://bithappens.github.io/copy-link-bookmarklet/
The Unlicense
3 stars 0 forks source link

Copy favicon along with the title of the page? #10

Open bithappens opened 1 year ago

bithappens commented 1 year ago

It would be nice if there is any option to copy the favicon in front of the text from the title. Nevertheless, there does not seem to be a direct way to include this in all formats. Not even to read the favicon via JavaScript.

bithappens commented 1 year ago

Maybe something like this could be a start: document.querySelector("link[rel='shortcut icon']") or document.querySelector("link[rel='icon']") or document.querySelector("link[rel='icon'], link[rel='shortcut icon']").href

bithappens commented 1 year ago

It seems like there is normalization of some type needed. If this is ever implemented, it needs a lot of tests and checks.

DrKain commented 1 year ago

This has been my go-to for favicons and might help:

https://external-content.duckduckgo.com/ip3/github.com.ico
bithappens commented 1 year ago

Cool! This seems like it solves many problems related to the preparation and filtering. Is there any documentation about it somewhere? For direct copy in the text 16x16 for example might be the better choice. Or rather, some experiments are needed for the optimal display into the copied text - and the different formats.

With the current info, the workflow seems to be: read window.location.host - build the URL for ddg - download the icon - encode it into base64. Build the output format. Copy into clipboard.

DrKain commented 1 year ago

No documentation that I'm aware of. It's used in DDG search results so it should be fairly reliable.