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.