jonleighton/poltergeist — pull request #438 by alexanderadam (2013-12-27 20:02:03+00:00)
Title: Integration of onResourceRequested (Issue #403)

This is the result from https://github.com/jonleighton/poltergeist/issues/403 and "reactivates" the onResourceRequested functionality from phantomjs.
In the spec ( https://github.com/alexanderadam/poltergeist/blob/c27d9b279fdb579bf3c5b95b24ed6a9e31a431b4/spec/integration/driver_spec.rb#L710 ) you can see how you can control the accepting/blocking of a request.
The request will just be blocked if there is a JavaScript snippet given and it returns a falsy value.