Add support for PhantomJS

*Needs review.* This pull request adds support for recognizing the PhantomJS user agent string correctly. While this isn't strictly necessary, it makes headless testing easier by not having to set a custom user agent string.