Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 10th, 2004, 01:46 AM
Authorized User
 
Join Date: Jun 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to nlicata
Default please help ping from client browser

Using basic client script I need to have a client browser ping or check for connection state to a predetermined server in code (filled dynamically).. There is no server involved, it is a web page in a data stream from C++.

The ROM chip sends a web page (like linksys router config pages) and I now have a client side refresh in there, but I need the refresh to only ocurr if the site is available (because ROM chip machine may be rebooting).. It just needs to be simple client side (any language) script that will ping or check for connection state (like session.isConnected in asp)...

Someone please help, I will be done with this is finished....
thanks,
Nick
 
Old June 10th, 2004, 12:23 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Nick,

This will work in IE with MSXML4 installed...

<html>

<head>
<title>Scrap</title>
<script type="text/javascript">
var xmlHttp;
function SetRefreshTimer(){
    // attempt refresh after 10 seconds
    setTimeout("DoRefresh()", 10000);
}
function DoRefresh(){
    xmlHttp = new ActiveXObject("Msxml2.XmlHttp.4.0");
    xmlHttp.open("GET", window.location.href);
    xmlHttp.send();
    if(xmlHttp.status == 200){
        window.location.reload();
    }else{
        SetRefreshTimer();
    }
}
</script>
</head>

<body onload="SetRefreshTimer();">
</body>

</html>

HTH,

Chris






Similar Threads
Thread Thread Starter Forum Replies Last Post
opening client side folder browser in c# sauravnimesh .NET Framework 2.0 4 November 21st, 2008 07:20 AM
error when displaying messagebox on client browser alexdcosta ASP.NET 2.0 Basics 5 June 24th, 2006 12:41 PM
sending streaming audio files to client browser hotshot_21 ASP.NET 1.0 and 1.1 Professional 1 March 28th, 2006 12:29 AM
please help ping from client browser nlicata Javascript How-To 0 June 10th, 2004 01:46 AM
please help ping with client side script nlicata VBScript 0 June 10th, 2004 01:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.