verify page loaded succesfully in frame

L

Luis Hernandez

What is the standard practice to verify that a page has loaded succesfully
in a frame when one issues a framename.href="url"? For example, detecting
404's, or other errors (like domain doesn't exist).

thanks
 
K

kaeli

"Luis Hernandez" <luish said:
What is the standard practice to verify that a page has loaded succesfully
in a frame when one issues a framename.href="url"? For example, detecting
404's, or other errors (like domain doesn't exist).

I believe you can have an onload handler for a frame, as with an image.
But keep in mind that if the source is not on the same server, domain, and
protocol, you can't check the doc to see if it's a 404 or not.
For this kind of thing, server-side scripting is better.

--
--
~kaeli~
Profanity: the single language in which all programmers are
expert.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 
L

Luis Hernandez

kaeli said:
microsoft.com> enlightened us with...

I believe you can have an onload handler for a frame, as with an image.
But keep in mind that if the source is not on the same server, domain, and
protocol, you can't check the doc to see if it's a 404 or not.
For this kind of thing, server-side scripting is better.

So how would I do that?

(1) parent.theframe.location.href=URL
(2) ??

The pages loaded in the frames are all in the same domain so I have full
access to the contents.

Is there a standard way of checking that 'all is ok' ? Otherwise, I have to
use findText("404") or variations of it?

Thanks!
 
K

kaeli

So how would I do that?
[/QUOTE]

I found this at our very own FAQ for this group. Go figure. :)

[quote src='[URL]http://jibbering.com/2002/4/httprequest.html[/URL]']
Does a url exist?
Another simple use is finding if a url exists, in HTTP there are various
status codes returned by both HEAD and GET requests, 200 means success, 404
means failure, and the others mean other things. See HTTP status codes for a
full explanation. using the status property of the xmlhttp object provides
you this status

xmlhttp.open("HEAD", "/faq/index.html",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) alert("URL Exists!")
else if (xmlhttp.status==404) alert("URL doesn't exist!")
else alert("Status is "+xmlhttp.status)
}
}
xmlhttp.send(null)
[/quote]

Obviously, this is only supported by more recent browsers.

--
 

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
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top