Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JavaScipt: Look before you link?

0 views
Skip to first unread message

Eric Losby

unread,
Dec 10, 1996, 3:00:00 AM12/10/96
to


Does anyone know if it is possible to "look before you link" to another
page?
Can I use JavaScript to test for the existence of a web document somehow
using
window.location.href?

Thanks.

Eric
gel...@govst.edu

htor...@novice.uwaterloo.ca

unread,
Dec 10, 1996, 3:00:00 AM12/10/96
to

Eric Losby (gel...@govst.edu) wrote:
:
:
: Does anyone know if it is possible to "look before you link" to another

: page?
: Can I use JavaScript to test for the existence of a web document somehow
: using
: window.location.href?
:
I don't see how to do this efficiently in Javascript...

If you can, you should better use a cgi script, giving a HEAD request to
the http server, then either send a location: line, either display an
error page..

--
Henri Torgemane http://www.undergrad.math.uwaterloo.ca/~htorgema/

Never let your sense of morals prevent you from doing what is right.
-- Salvor Hardin, "Foundation"

Kreme

unread,
Dec 10, 1996, 3:00:00 AM12/10/96
to

htor...@novice.uwaterloo.ca wrote in article
<E26r3...@novice.uwaterloo.ca>...

> Eric Losby (gel...@govst.edu) wrote:
> : Does anyone know if it is possible to "look before you link" to another
> : page?
> : Can I use JavaScript to test for the existence of a web document
somehow
> : using
> : window.location.href?

> If you can, you should better use a cgi script, giving a HEAD request to


> the http server, then either send a location: line, either display an
> error page..

couldn't you attempt to load the page in a new window and check for an
error condition? if no error, close the current window so the new window
replaces it. It seems this would work.


htor...@novice.uwaterloo.ca

unread,
Dec 11, 1996, 3:00:00 AM12/11/96
to

Kreme (kr...@worldnet.att.net) wrote:
: htor...@novice.uwaterloo.ca wrote in article
:

It would probably be better to use a very small ( hidden ) frame to do this.
The only problem would be to know when a loaded page is an error message
from the server or the regular page...
If you have access to the source of the page, you can simply set a javascript
property in the document.. If not, I don't really know how to do this reliably..

0 new messages