Checking for valid URL

Devin Asay devin_asay at byu.edu
Mon Mar 1 10:47:03 EST 2004


Hi, all.

Does anyone have a favorite way of ascertaining whether the data 
requested from a URL is actually successfully downloaded? I have tried 
simply checking the status of the container that receives the data, 
usually a field for text or an image object for image data. This works 
fine for text; i.e.,

put url "http://www.domain.com/mytext.txt" into fld "myfield"
if fld "myfield" is empty then answer "Bad URL."

But the same technique does not seem to work for image data; i.e.,
image "myimage" is empty -- always seems to return true

I've shied away from the load command because I'm typically loading 
lots of image or html data and don't want to bloat my application with 
cached data. But if I were to do load all URLs before displaying the 
data I'd have access to the URLStatus function, and could check for 
"error" or "timeout" or empty results.

For those of you who use the Internet library stuff: Is there a "best 
practices" approach to checking for successful data download. I'm 
interested in your experience and recommendations.

Thanks,

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University



More information about the use-livecode mailing list