Fix cross-origin image rendering

This commit is contained in:
√(noham)² committed 2026-11-11 00:37:08 +01:00
1 parent eaff0ca975
commit 640b5d830c
1 file changed
+9
+9
View File
@@ -143,6 +143,15 @@ export async function extractRenderedContent (page) {
doc.documentElement.setAttribute('data-mode', dataMode) doc.documentElement.setAttribute('data-mode', dataMode)
} }
// The article HTML is later re-rendered from an opaque origin (about:blank),
// so resources become cross-origin. Sites rarely send CORS headers for
// images, which makes images with `crossorigin="anonymous"` fail to load
// (and `integrity` checks reject them). Strip both so images render.
for (const el of doc.querySelectorAll('[crossorigin], [integrity]')) {
el.removeAttribute('crossorigin')
el.removeAttribute('integrity')
}
const cs = getComputedStyle(doc.documentElement) const cs = getComputedStyle(doc.documentElement)
const cssVars = ['--fg', '--bg', '--bd', '--lk', '--hg'] const cssVars = ['--fg', '--bg', '--bd', '--lk', '--hg']
const inlineVars = cssVars const inlineVars = cssVars