I have tested jsdom and it works fine so far. There is only one thing that is missing for me. There should be an optional way to set an user-agent in jsdom.env as there are sites (e.g. wikipedia) that do not allow to be requested without an user-agent. http://meta.wikimedia.org/wiki/User-Agent_policy
While crawling a few pages with jsdom, I receive the following message after a few successful crawlings:
Scripts should use an informative User-Agent string with contact information, or they may be IP-blocked without notice.
there are two issues here:
Was this ever incorporated into main?
the fix / tests have not yet been written. Are you up for the task?
+1 for this one, I have the same issue with jsdom . When will this feature be implemented ?
When somebody writes the code and tests for it
I've started work on this, but I'm not sure if I'm going about it correctly.
Here's my branch: https://github.com/jeffstieler/jsdom/tree/196_set_user_agent
All of the tests still pass, but I've removed the usage of __proto__ from the DOMWindow prototype modification - I'll have to claim ignorance for not being able to still incorporate that.
What I have discovered though, is that you can specify a User Agent if you are using the jsdom.env convenience function.
Since it uses the request module rather than the core resource loader, it can accept a "headers" property on the configuration object.
Was this ever implemented?
@lyetz nope. Thanks for bringing it up though; we can try to make it a priority. I already saw the need to rearrange this code for #424 anyway.
@domenic Is this a feature request? I'd be glad to work on it.
@oveddan go for it!
@domenic Is this already doable via the ability to set headers as done in #225?
I doubt that would affect the client-side navigator.userAgent
Wait, yes, this is definitely doable via config.headers. Closing.