Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Test if my page is up using javascript?

Reply
Thread Tools

Test if my page is up using javascript?

 
 
Bill DeWitt
Guest
Posts: n/a
 
      09-10-2006

I want to supply a button on my public web page if I have opened up my
private web page, but disable it or remove it if the private page is shut
down. Is this possible?

In other words, I often have a port open for a chat page and I use
no-ip.com to do a port redirect. When the port is open, I want my public
page to test the port when a user loads the page, and if the port is
available, supply a button to click over to it.

Sort of like the service at http://www.canyouseeme.org/, except I would
provide the ip and port in the code.

Can this be done with Javascript? Thanks for any help.


 
Reply With Quote
 
 
 
 
Joshie Surber
Guest
Posts: n/a
 
      09-11-2006
If both are on the same domain (different subdomains are okay) you
could use a cookie.

If that won't work, your other option (as I see it) is more convoluted.
Have the private page set up a script that polls the server (either
one) every few seconds, with something tagging along on the request to
ID whoever is on the page. You will need something server side to keep
track of the polling, but the JS would be easy: just request a PHP (or
asp, etc) generated image with new Image().src='polling.php'. Set up
something similar on the public page that does likewise, but requests a
differant image. Then if your polling shows that the person IS on your
private page, return a single pixel gif, but return your button
otherwise.

Bill DeWitt wrote:
> I want to supply a button on my public web page if I have opened up my
> private web page, but disable it or remove it if the private page is shut
> down. Is this possible?
>
> In other words, I often have a port open for a chat page and I use
> no-ip.com to do a port redirect. When the port is open, I want my public
> page to test the port when a user loads the page, and if the port is
> available, supply a button to click over to it.
>
> Sort of like the service at http://www.canyouseeme.org/, except I would
> provide the ip and port in the code.
>
> Can this be done with Javascript? Thanks for any help.


 
Reply With Quote
 
 
 
 
Bill DeWitt
Guest
Posts: n/a
 
      09-11-2006
Hi, Joshie. Thanks for taking the time to respond.

Of course, I don't know or else I wouldn't ask, but that seems a little
complicated. Perhaps I asked the question wrong. I had envisioned something
like...

" if (ping(address)) then hotbutton else greybutton "

....but, of course, in javascript.

I don't think I need constant updating, just a check on loading the page.


"Joshie Surber" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> If both are on the same domain (different subdomains are okay) you
> could use a cookie.
>
> If that won't work, your other option (as I see it) is more convoluted.
> Have the private page set up a script that polls the server (either
> one) every few seconds, with something tagging along on the request to
> ID whoever is on the page. You will need something server side to keep
> track of the polling, but the JS would be easy: just request a PHP (or
> asp, etc) generated image with new Image().src='polling.php'. Set up
> something similar on the public page that does likewise, but requests a
> differant image. Then if your polling shows that the person IS on your
> private page, return a single pixel gif, but return your button
> otherwise.
>
> Bill DeWitt wrote:
> > I want to supply a button on my public web page if I have opened up my
> > private web page, but disable it or remove it if the private page is

shut
> > down. Is this possible?
> >
> > In other words, I often have a port open for a chat page and I use
> > no-ip.com to do a port redirect. When the port is open, I want my public
> > page to test the port when a user loads the page, and if the port is
> > available, supply a button to click over to it.
> >
> > Sort of like the service at http://www.canyouseeme.org/, except I

would
> > provide the ip and port in the code.
> >
> > Can this be done with Javascript? Thanks for any help.

>



 
Reply With Quote
 
Tom Cole
Guest
Posts: n/a
 
      09-11-2006

Bill DeWitt wrote:
> Hi, Joshie. Thanks for taking the time to respond.
>
> Of course, I don't know or else I wouldn't ask, but that seems a little
> complicated. Perhaps I asked the question wrong. I had envisioned something
> like...
>
> " if (ping(address)) then hotbutton else greybutton "


Why not have your "sometimes offline" site provide the image for the
button. If your site's not there, then no picture...leaves you with
other things to think about...

or...

Another option is to fire off an XmlHttpRequest to the "sometimes
offline" site and read the status. If you don't get a 200 (or if you do
get a 404 it's up to you) then no show, otherwise, do show...

HTH

>
> ...but, of course, in javascript.
>
> I don't think I need constant updating, just a check on loading the page.
>
>
> "Joshie Surber" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) ups.com...
> > If both are on the same domain (different subdomains are okay) you
> > could use a cookie.
> >
> > If that won't work, your other option (as I see it) is more convoluted.
> > Have the private page set up a script that polls the server (either
> > one) every few seconds, with something tagging along on the request to
> > ID whoever is on the page. You will need something server side to keep
> > track of the polling, but the JS would be easy: just request a PHP (or
> > asp, etc) generated image with new Image().src='polling.php'. Set up
> > something similar on the public page that does likewise, but requests a
> > differant image. Then if your polling shows that the person IS on your
> > private page, return a single pixel gif, but return your button
> > otherwise.
> >
> > Bill DeWitt wrote:
> > > I want to supply a button on my public web page if I have opened up my
> > > private web page, but disable it or remove it if the private page is

> shut
> > > down. Is this possible?
> > >
> > > In other words, I often have a port open for a chat page and I use
> > > no-ip.com to do a port redirect. When the port is open, I want my public
> > > page to test the port when a user loads the page, and if the port is
> > > available, supply a button to click over to it.
> > >
> > > Sort of like the service at http://www.canyouseeme.org/, except I

> would
> > > provide the ip and port in the code.
> > >
> > > Can this be done with Javascript? Thanks for any help.

> >


 
Reply With Quote
 
Bill DeWitt
Guest
Posts: n/a
 
      09-11-2006

"Tom Cole" <(E-Mail Removed)> wrote :
>
> Why not have your "sometimes offline" site provide the image for the
> button. If your site's not there, then no picture...leaves you with
> other things to think about...


Hmm... I will try this, but I suspect that my "integrated chat/server
software will not allow it.

> Another option is to fire off an XmlHttpRequest to the "sometimes
> offline" site and read the status. If you don't get a 200 (or if you do
> get a 404 it's up to you) then no show, otherwise, do show...


This sounds possible, both that it could work and that I could
accomplish it Although I have no idea what a "XmlHttpRequest " is...

I will go look it up now, thanks for your response!


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
test test test richard Computer Support 3 01-24-2007 05:18 AM
TEST TEST Test...Blah Blah Blah generalbatguano@pacbell.net Computer Support 2 09-15-2006 03:47 AM
TEST TEST Test...Blah Blah Blah Generalbatguano@pacbell.net Computer Support 6 09-13-2006 01:53 AM
TEST TEST TEST Gazwad Computer Support 2 09-05-2003 07:32 PM
test test test test test test test Computer Support 2 07-02-2003 06:02 PM



Advertisments