How to configure Poltergeist or PhantomJS to not follow redirects?
问题 I have some tests that require the JS driver to not follow redirects. Is it possible to configure Poltergeist to do this? I noticed that it is possible to pass commands to PhantomJS using the Command Line Interface, so perhaps that is another way of doing this? 回答1: I'm not familiar with Poltergeist, so I'm only going to answer about PhantomJS. All you need for this are the two event handlers page.onResourceRequested and page.onResourceReceived. An HTTP redirect produces both a HTTP request