Doesn’t work (at least for me in Chrome with Tampermonkey) due to Hacker News’s Content-Security-Policy header. > Refused to load the image ' ' because it violates the following Content Security Policy directive: "img-src data: 'self' ". Overriding this would probably require an extension with a Service Worker that edits the CSP header.
Yeah, appears XHR/fetches are similarly blocked – was looking into data URIs. Good job HN for getting a decent CSP set up!
Show HN: Favicons for HN
31–40 of 73 posts
Re: Show HN: Favicons for HN
#32Re: Show HN: Favicons for HN
#33Re: Show HN: Favicons for HN
#34Anybody have a Chrome-plugin version of this? Or should I look into making it when I get home? :)
Re: Show HN: Favicons for HN
#35Doesn’t work (at least for me in Chrome with Tampermonkey) due to Hacker News’s Content-Security-Policy header. > Refused to load the image ' ' because it violates the following Content Security Policy directive: "img-src data: 'self' ". Overriding this would probably require an extension with a Service Worker that edits the CSP header.
Re: Show HN: Favicons for HN
#36Earlier quoted context omitted.
This - an alternative approach could be to create the images with a URL of '{domain}/favicon.ico' and then add an onError event to switch the URL to the DDG URL only for instances where the site's favicon isn't in the default location.
Many sites have png favicons that may be stored anywhere. You kind of need to parse the HTML to be sure, and I guess that's what the DDG service does.
Re: Show HN: Favicons for HN
#37Doesn’t work (at least for me in Chrome with Tampermonkey) due to Hacker News’s Content-Security-Policy header. > Refused to load the image ' ' because it violates the following Content Security Policy directive: "img-src data: 'self' ". Overriding this would probably require an extension with a Service Worker that edits the CSP header.
It's possible that GreaseMonkey on Firefox has different policies than other extensions on Chrome
ViolentMonkey supports this API, but unfortunately doesn't use it by default. You can enable it with `// @inject-into content` in the header.
Firefox additionally has an API and context specifically for user scripts (the userScript API), but GreaseMonkey doesn't use this unfortunately. A pull request adding support for it to either GM or ViolentMonkey would be nice if someone knowledgeable were so inclined. This API provides some additional protection (scripts are subject to SOP unless the extension breaks them out, and scripts are in addition isolated from each other), so it's a "nice-to-have" but not totally necessary if your user scripts come from trustworthy sources (i.e. you write them yourself).
[1] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web...
Re: Show HN: Favicons for HN
#38Re: Show HN: Favicons for HN
#39I don't want HN to turn into something like slack that is filled with emojis and animated gifs.
It's just too much noise.
Re: Show HN: Favicons for HN
#40I can imagine how it looks like, but a screenshot would be nice anyway.