Forum Moderators: open

Message Too Old, No Replies

checking to see if a url is active?

probably an easy javascript question

         

johnglass

5:31 am on Mar 26, 2004 (gmt 0)

10+ Year Member



Hi all,

Very new to Javascript (working on PHP and MySQL right now) maybe you guys have an easy answer for this?...

I have a Shoutcast radio station that's on and off pretty regularly. I'd like to put a "power light" on my site that would indicate when the station is running.

So basically, I need a script that would check to see if the url (format: mysite.com:8000/listen.pls) is active, if so include one graphic (two, actually), if not, include another. Sounds like it'd be pretty easy, but I don't know how to do it. :)

I'm not sure if Javascript is the way to go... I'm pretty sure html can't handle it, maybe php could... Anyway, Javascript seemed like the logical choice to me.

So, I'm here to ask what the best language for that would be, and how do you do that?

Thanx :)

ajkimoto

4:57 pm on Mar 26, 2004 (gmt 0)

10+ Year Member



johnglass,

If you were going to check a regular html page link, I would say that you could load the page in a hidden iframe and then have a function to check the content of the document and markup the link accordingly.

However, since this is not an html page and will be handled by an external program, the act of checking the link would launch the external program, so...

Maybe the best way to handle this is on the server side.

ajkimoto

johnglass

12:40 am on Mar 27, 2004 (gmt 0)

10+ Year Member



Hi Ajkimoto, thanx for the response,

I've never used an Iframe before (is that regular html?), but looking it up it seems like that might be the answer. It doesn't really need to check the content or anything, just check to see if that link is active (if the station is off, you get a "Page cannot be displayed" message).

I'll give it a shot :)