Welcome to WebmasterWorld Guest from 184.108.40.206
Forum Moderators: open
I asked this a while back and got zero response and came to the conclusion that with JS alone there is no way. However, you can use PHP to determine if the site is available and do a document.write based on your findings. Similarly (though slightly more complex) you can do it via a perl SSI script.
Hope that helps a bit :)
Better off with someone else's code:
- in particular, the heading: Does a URL exist?
Oh yes. Undert 'normal' security settings, this can only be used to load¦test a document within the same domain. If you need to test for a page outside you own domain, then you will need some kind of server-side solution (possibly using server-side XMLHTTPRequest).
That sounds quite good. The requirements ask merely for testing a website, so we have no risk of a custom 404 page.
Not so confident about browsers being nice, and actually firing that onerror.
Browsers? Never trust 'em me.
"pull a .gif file from the target site and use 'onerror'"
I was thinking of suggesting something like that. It's cool, just as long as:
a) The website isn't arbitrary (eg: typed in by user).
b) The website doesn't decide to remove the image.
Jalarie, I have always had a problem geting Mozilla to fire an onerror. Does it work for you?
I would like to interrupt this thread to express my surprise that the ability to access response headers via script isn't a standard browser API feature.
(..or am I missing something?)