Forum Discussion
bryanharley
11 years agoVisitor
I agree it would be better to do this without a server.
Someone else wrote this javascript, but I was not able to get it to work client-side in a browser. Any idea why?
Someone else wrote this javascript, but I was not able to get it to work client-side in a browser. Any idea why?
<script>
function post1() {
xdr = new XDomainRequest();
xdr.onload=function()
{
alert(xdr.responseText);
}
xdr.open("POST", "http://192.168.110.100:8060/keypress/home");
xdr.send();
postdelay1();
}
function postdelay1() {
setTimeout("post2()",1000);
}
function post2() {
xdr = new XDomainRequest();
xdr.onload=function()
{
alert(xdr.responseText);
}
xdr.open("POST", "http://192.168.110.100:8060/launch/12333");
xdr.send();
postdelay2();
}
function postdelay2() {
setTimeout("post3()",1000);
}
function post3() {
xdr = new XDomainRequest();
xdr.onload=function()
{
alert(xdr.responseText);
}
xdr.open("POST", "http://192.168.110.100:8060/keypress/right");
xdr.send();
postdelay3();
}
function postdelay3() {
setTimeout("post4()",1000);
}
function post4() {
xdr = new XDomainRequest();
xdr.onload=function()
{
alert(xdr.responseText);
}
xdr.open("POST", "http://192.168.110.100:8060/keypress/select");
xdr.send();
postdelay4();
}
function postdelay4() {
setTimeout("post5()",1000);
}
function post5() {
xdr = new XDomainRequest();
xdr.onload=function()
{
alert(xdr.responseText);
}
xdr.open("POST", "http://192.168.110.100:8060/keypress/select");
xdr.send();
postdelay5();
}
function postdelay5() {
setTimeout("post6()",1000);
}
function post6() {
xdr = new XDomainRequest();
xdr.onload=function()
{
alert(xdr.responseText);
}
xdr.open("POST", "http://192.168.110.100:8060/keypress/select");
xdr.send();
}
</script>
<body onload="post1()">