View Full Version : Determing a valid URL
Hi!,
I was wondering if their is a javascript function that I can pass a "URL" to and it would indicate whether or not it is a valid URL.
Thanks
Jim
jroberts@nahp.com
beetle
11-13-2002, 06:06 PM
Big ol' thread discussing that here (http://www.codingforums.com/showthread.php?s=&threadid=9241)
Actually, I am looking to determine if the URL that is used in the window.open function is valid. In otherwords, does the page actually exist before I call it. I do not want to get that annoying page not found error. I want to know if the page exists before I call for it. Sorry for the confusion.
Thanks
Jim
beetle
11-13-2002, 06:26 PM
Oh, you're not going to be able to do this with javascript. It can be done with HTTP via a server-side language AFAIK, but I'm not familiar with that method.
whammy
11-14-2002, 12:29 AM
Yup, there's no way for javascript to determine that information.
With a server-side language you could probably do some sniffing to see if it was a valid URL (I know you can do this with email addresses), although I have never had the need or inclination to do that (yet). So I'm with beetle on the "AFAIK". :D
Besides, in the the time your "sniffer" ran, and the page was found to be valid, the remote server could go down (although that would probably be a rare occurence).
P.S. You aren't doing some kind of javascript password scheme are you? ;)
I just get a funny feeling of dejavu... lol... since I've been there and done that.
If you ARE, then you'll have to live with the 404 error for now - the only way to truly password protect a site is with a server-side language.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.