What type of thing did PhantomJS load?

15 views
Skip to first unread message

Jon Ribbens

unread,
Sep 15, 2016, 6:18:39 PM9/15/16
to phantomjs
I was wondering, is there a way to find out what type of thing PhantomJS loaded after you called page.open()? Specifically, whether it was an (X)HTML page or not?

If you point PhantomJS at something that isn't HTML then it has various behaviours - e.g. if it's an image it invents some HTML with an <img> tag pointing to that image. Bear in mind that a various obvious-looking solutions are harder than they might first appear - e.g. what if the opened URL redirected somewhere else, what if the URL had no Content-Type and PhantomJS did some content sniffing, what if it was an opaque binary file that couldn't be handled at all?

Any suggestions gratefully received.
Reply all
Reply to author
Forward
0 new messages