Google Grupper støtter ikke lenger nye Usenet-innlegg eller -abonnementer. Historisk innhold er fortsatt synlig.

Possible to Disable load errors?

Sett 128 ganger
Hopp til første uleste melding

Peter Bayley

ulest,
26. apr. 1999, 03:00:0026.04.1999
til
Hi,

I'm building a litle GIS application using JavaScript (beginning to
think I'm a masochist!)
Most things work fine in NS4.5 and IE4/5 but I have sparsely populated
the database the app draws its data (images and attributes from).
Basically, the app will attempt to load a particular image or html - if
it's not there that should NOT be an error

NS seems happy to ignore the lack of a file but IE5 presents this
helpful but annoying page saying "The page cannot be displayed" and
offering all sorts of help - and completely destroying (replacing) my
app along the way!

Does any one know of a way to stop the error. It occurs during:

document.all.tags("IFRAME").item(0).src=path;

where path is a tring giving the path to the document that might not
exist. I have to load the document into the IFRAME in IE as you can't
load an external URL into a DIV in IE (can in NS). I've tried:

1. document.all.tags("IFRAME").item(0).onerror=ignoreError;
where ignoreError is a null function (does nothing)
2. try {
document.all.tags("IFRAME").item(0).onerror=ignoreError;
document.all.tags("IFRAME").item(0).src=path;
}
catch (exception) {
alert("Error: "+Error.number+" "+Error.description);
return true;
}
3. window.onerror=ignoreError

but it still seems to cause the error before any of my error handlers
are invoked

All help appreciated and thanks in advance

Peter


Martin Honnen

ulest,
26. apr. 1999, 03:00:0026.04.1999
til
If ie treats that as a js error
window.onerror = null;
or
window.onerror = handleError;
where
function handleError (e, u, l) {
if (e.indexOf("page cannot be displayed") > -1)
return true;
else
return false;
}
should be the way to prevent the error message.

--

Martin Honnen

mailto: Martin...@sector27.de
http://www.sector27.de/martin.honnen

Peter Bayley

ulest,
27. apr. 1999, 03:00:0027.04.1999
til Martin Honnen
Hi Martin,

Thanks for the suggestion - but I've already tried it (just tried it again)
and it doesn't work

It seems the error is handled deep down in Explorer before it ever gets close
to user-definable error-handlers

Regards

0 nye meldinger