I know of no way from javascript in the client to verify the content-type of a URL that isn't on the same domain as the web page because you can't use ajax outside of the domain of the web page. All we're checking is that the url has a protocol https://, hostname foobar.com, slash / and then image name. Step 1. Are the S&P 500 and Dow Jones Industrial Average securities? Detecting an "invalid date" Date instance in JavaScript, Get the size of the screen, current web page and browser window. !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)? In the above example first we have added a basic html file to upload the image. Validate image extension: For that we will match the file name extension. ]]>,