lelinhtinh / Userscript

Userscripts collection
http://devs.forumvi.com/f23-userscript
MIT License
151 stars 53 forks source link

Image Viewer doesn't work on some sites or domains (e.g. Github) #117

Closed Roccobot closed 2 years ago

Roccobot commented 2 years ago

Describe the bug While submitting the previous request, I noticed the Userscript doesn't work on some sites/domains.

To Reproduce Open this image in a new tab

Expected behavior The image should be centered and surrounded by checkerboard. Instead, it is positioned top-left with white all around.

Screenshot

Schermata 2022-06-08 alle 18 14 31

Context

lelinhtinh commented 2 years ago

This issue is caused by the HTTP Content Security Policy, which blocks injection scripts.

Tampermonkey can bypass the CSP by adjusting the configuration:

https://github.com/Tampermonkey/tampermonkey/issues/952#issuecomment-638373937

Roccobot commented 2 years ago

Thanks Oh, well, if that can cause security issues I guess I'll keep it the way it is, but good to know!