0

Hi guys.,

I have a textbox for entering URL. I validate that URL using regular expression. Now the problem is, How do i know whether the entered URL is exist or not.?

For example, if user enter "http://www.daniweb.cam" rather entering "http://www.daniweb.com", how do i intimate them that the entered url is not valid.?

Is it possible..?

Please kindly advise me....

Thanks,
DragonBaki.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Airshow
0

Dragonbaki,

I've not needed to do this but here are my thoughts .....

The most efficient way would be to make what's called a "HEAD request" and the easiest way I can find to do this is a jQuery plugin:
http://plugins.jquery.com/project/jqHead

As written, I'm pretty certain this plugin won't handle cross-domain requests, which may be an issue for you.

For cross-domain, you have a couple of basic options:

  • Flash-proxy: I like FlXHR. With a little thought, this should be usable with a modified jqHead plugin, because core jquery allows you to specify your own xmlhttp object in a $.ajax request (see this and jquery API).
  • PHP Proxy: Build you own or find a script on the web. With this approach, javascript will make its request to a same-domain php script (ie on same server as the current web page); the script will use php's capability to make a request to another domain (I'm no expert here - see PHP manual).

Airshow

Edited by Airshow: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.