Microsoft
Software
Hardware
Network
Question : Java Script, Retry on HTTP GET Connection Timeout
Hi there,
I need to add the feature of if the website is unavailable, to wait 10 seconds and try again. If my website is still unavailable, try again 5 times, if still navailable, echo "UnableToConnect" then exit.
IT WOULD LOGICALLY LOOK SOMETHING LIKE THIS (but in Java Script):
SET ConnectCounter=0
:Home
Echo
http://www.MyWebSite.com
Send the GET command to the website and ECHO it out
If can't connect to
http://www.MyWebSite.com
(
If %ConnectCounter% GEQ 5 (
ECHO UnableToConnect
EXIT
)
SET /a ConnectCounter=%ConnectCou
nter%+1
Add a delay of 10Seconds
)
Goto home
HERE IS MY ORIGINAL WORKING JAVA SCRIPT:
var request = new ActiveXObject("Msxml2.XMLH
TTP");
var notyetready = 1;
request.onreadystatechange
=function(
)
{
if(request.readyState==4)
{
WScript.Echo(request.respo
nseText);
notyetready = 0;
}
}
var objArgs = WScript.Arguments;
WScript.Echo("
http://www.M
yWebSite.c
om
");
request.open( "GET", "
http://www.MyWebSite.com
"
, true );
request.send(null);
while( notyetready )
{
WScript.Sleep( 100 );
}
Thanks for your help,
Rene
Answer : Java Script, Retry on HTTP GET Connection Timeout
I don't know JavaScript very well, but JavaScript is not Java.. they only have their names in common. You want to put your question under prog languages/scripting languages/JavaScript. Good luck!
Random Solutions
How to uninstall and clean up the Huawei HSDPA USB modem driver?
Exchange 2010 Antivirus Options
Mapping to skydrive via windows explorer
Converting RTF to PDF on the fly.
Powerpoint 2003 - in Vista -
imap_mail_move on POP3 mailbox
Outlook won't open .pptx attachment directly
Enteprise Application Documentation Application
How do I add rows to a datagridview based upon a For Each statement in VS2008?
Checkpoint VPN Site to Site Issue - encryption failure: Unknown SPI: 0xb41565ee for IPsec packet.