Executing script in browser console gives different results as executing extension (css styles issues) #1456
-
Hello, I'm trying to retrieve the html content using the "single-file.js" script in Firefox / Chrome browser console, it is working but the issue is that the HTML result has issues with the CSS styles. The code that I'm using to extract the page content is: const { content, title, filename } = await singlefile.getPageData({
removeHiddenElements: true,
removeUnusedStyles: true,
removeUnusedFonts: true,
removeImports: true,
blockScripts: true,
blockAudios: true,
blockVideos: true,
compressHTML: true,
removeAlternativeFonts: true,
removeAlternativeMedias: true,
removeAlternativeImages: true,
groupDuplicateImages: true
}); Use as example: this website Steps:
Probably the issue is with the CORS error, how can I fix this error using the javascript code in the browser? Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You could try to run Chrome with the switch |
Beta Was this translation helpful? Give feedback.
You could try to run Chrome with the switch
--disable-web-security
. AFAIK, there is no equivalent option in Firefox but using a proxy could help, see http://www.simplyaprogrammer.com/2013/12/using-fiddler-to-force-web-service-to.html for example.The simplest solution is to use single-file from the command line interface if possible, see https://github.com/gildas-lormeau/single-file-cli.