i load the url and i need to run different functions for different url type; if it is pdf, image or html page. Does anyone know how i can realize this from url string.
I used to use pathExtension before but it will not always work since some html page does not have any extension.
thanks in advance
Unless you ask the server (ie make the request and get the MIME type back), then you aren’t going to be able to know unless you have control of the server and you make sure that all the URLs adhere to a given standard. But I’m assuming that you are talking about URLs across the Internet on any server in which case you have no way of knowing. Also remember that some URLs may not return what they suggest. So, a PHP might actually return a PDF or an image.