Test URL before using it?

R

Robert Oschler

I'd like to be able to see if a URL was functional before I attempt to put
it in an IFrame. Is there a way to do this so I can prevent the user from
ending up with a 404 error page in the IFrame?

thx

--

Robert Oschler
"Let the web hear you, add your voice to your web site in minutes!"
-- http://audiodirect.spiderchase.com/
(For a limited time, free voiceover with every sign-up, use this link
instead)
-- http://audio.spiderchase.com/
 
K

kaeli

I'd like to be able to see if a URL was functional before I attempt to put
it in an IFrame. Is there a way to do this so I can prevent the user from
ending up with a 404 error page in the IFrame?

Not with javascript if the page is from a different domain, which I
assume it is or you'd know if it was there.
Could be done with dynamically generated pages (server-side), such as
JSP/servlet, using a language that understands URLs.


----------------------------------------
~kaeli~
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich.
----------------------------------------
 
G

Grant Wagner

Robert said:
I'd like to be able to see if a URL was functional before I attempt to put
it in an IFrame. Is there a way to do this so I can prevent the user from
ending up with a 404 error page in the IFrame?

thx

If you know your users are going to be using IE6+ and Netscape 7+, you could
use the XML HTTP Request object to check for the page prior to changing the
location of the iframe:

<url: http://jibbering.com/2002/4/httprequest.html />

--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top