Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block scripts #462

Closed
loilo opened this issue Aug 22, 2017 · 2 comments
Closed

Block scripts #462

loilo opened this issue Aug 22, 2017 · 2 comments

Comments

@loilo
Copy link
Contributor

loilo commented Aug 22, 2017

Easy question: Is there a reliable way to block execution of any JavaScript on a Page?

I've not found anything on this in the docs, but I'm curious if it's possible at all?

@JoelEinbinder
Copy link
Collaborator

What is your use case for this?

@loilo
Copy link
Contributor Author

loilo commented Aug 22, 2017

I'm fiddling around with scraping webpages using headless Chromium and want to offer some options for blocking scripts, styles, images.

For styles and images, this is mainly to save some bandwidth, so just checking the Accept request header suffices for my use case (read: blocking things like inline <style> blocks is not my focus there).

However scripts are a bit of another story since they may alter page contents, so I want to try and block them entirely.

Of course, as soon as I disable JavaScript execution, I could just use a simple HTTP-based web scraper for the job, but if there's an option in Chromium then using the same technology stack as for the rest of the scraper would be preferrable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants