mirror of
https://github.com/NohamR/pdfy.git
synced 2026-11-25 15:30:05 +00:00
Fix cross-origin image rendering
This commit is contained in:
1 parent
eaff0ca975
commit
640b5d830c
1 file changed
+9
@@ -143,6 +143,15 @@ export async function extractRenderedContent (page) {
|
||||
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 cssVars = ['--fg', '--bg', '--bd', '--lk', '--hg']
|
||||
const inlineVars = cssVars
|
||||
|
||||
Reference in new issue
Block a user