开发者

Javascript: How to check the existence of a url?

开发者 https://www.devze.com 2023-04-06 22:59 出处:网络
I need to check the whether an external url like http://www.example.com exists or not using开发者_如何转开发 javascript or ajax.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号