# Monitoring getUrl()

**URL:** <https://forum.kirupa.com/t/monitoring-geturl/119606>\
**Category:** Uncategorized\
**Created:** [August 16, 2004, 8:27pm UTC](https://forum.kirupa.com/t/monitoring-geturl/119606 "2004-08-16T20:27:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![penmig](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/penmig/32/167_2.png) [@penmig](https://forum.kirupa.com/u/penmig)\
**Post date:** [August 16, 2004, 8:27pm UTC](https://forum.kirupa.com/t/monitoring-geturl/119606/1 "2004-08-16T20:27:34Z")

</div>

HI, I’ve some links to permit the visitor to download documents (zip files) from the server, I need to trigger if the file doesn’t exist to send him an alert but seems that the function getUrl() can’t have listeners or handlers.

Anybody knows how can I do it ?

Thanks and have a nice day :sigh:

---

<div class="post-metadata">

**Author:** ![JakeO](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@JakeO](https://forum.kirupa.com/u/JakeO)\
**Post date:** [August 16, 2004, 11:24pm UTC](https://forum.kirupa.com/t/monitoring-geturl/119606/2 "2004-08-16T23:24:39Z")

</div>

> [@penmig](#):
>
> HI, I’ve some links to permit the visitor to download documents (zip files) from the server, I need to trigger if the file doesn’t exist to send him an alert but seems that the function getUrl() can’t have listeners or handlers.
> 
> Anybody knows how can I do it ?
> 
> Thanks and have a nice day :sigh:

look into XMLSocket

---

<div class="post-metadata">

**Author:** ![deQue](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@deQue](https://forum.kirupa.com/u/deQue)\
**Post date:** [August 16, 2004, 11:38pm UTC](https://forum.kirupa.com/t/monitoring-geturl/119606/3 "2004-08-16T23:38:20Z")

</div>

The “easiest” is using sockets, but that might get heavy on the server if you have heavy traffic on your site. another way to do this is setting a timeout period.  
Make an object that will load the target, and check to see if the target is loading (by checking if the totalBytesLoaded is greater than 4). If after X seconds (usually 4-7) it’s still 4 or lower, than it is not loading, and you can do whatever it is you want to do in that case.

---

<div class="post-metadata">

**Author:** ![penmig](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/penmig/32/167_2.png) [@penmig](https://forum.kirupa.com/u/penmig)\
**Post date:** [August 17, 2004, 5:27am UTC](https://forum.kirupa.com/t/monitoring-geturl/119606/4 "2004-08-17T05:27:39Z")

</div>

Thanks for the info JakeO & deQue

---

<div class="post-metadata">

**Author:** ![MissionSix](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@MissionSix](https://forum.kirupa.com/u/MissionSix)\
**Post date:** [August 17, 2004, 5:39am UTC](https://forum.kirupa.com/t/monitoring-geturl/119606/5 "2004-08-17T05:39:07Z")

</div>

an easy way to do this would be to make a php or asp download handler script. Therefore you could track how many times the file has been downloaded as well and store it in a database.

The way you would do this is do something like:

download.php?d=http://dljafjd.com/file.zip

then pass that string in the php file and redirect when your finished with the script. if the file doesnt exist it could take you to a “file not found” page.

---

<div class="post-metadata">

**Author:** ![penmig](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/penmig/32/167_2.png) [@penmig](https://forum.kirupa.com/u/penmig)\
**Post date:** [August 17, 2004, 12:17pm UTC](https://forum.kirupa.com/t/monitoring-geturl/119606/6 "2004-08-17T12:17:23Z")

</div>

Thanks MissionSix !!!
