2 ms·
Depending on the nature of the content being scraped, you can use the `sandbox` attribute to the iFrame to prevent scripts from running. https://developer.mozi
by ravenstine 7y ago
Depending on the nature of the content being scraped, you can use the `sandbox` attribute to the iFrame to prevent scripts from running.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox https://developer.mozilla.org/en-US/docs/Web/HTML/Element/if...
This was useful for a brief period when I ran a news aggregator that used iFrames to display content from other news websites. Adding the sandbox attribute prevented scripts, ads, modals, etc.
For the purpose of scraping, unless you're always on the same domain(or running a proxy to add CORS), I don't see how an iFrame is better than either a web extension or a backend script using Puppeteer.