Javascript: How to check the existence of a url?
I need to check the whether an external url like http://www.example.com exists or not using开发者_如何转开发 javascript or ajax.
Thanks in advance..
You can load it into a hidden iframe and see if you get content. You can't use "ajax" (e.g., an XMLHttpRequest call) for it, because you'll run into Same Origin Policy restrictions.
精彩评论