Hice este html que se encarga de controlar unos relays en mi arduino. En la pc mi mac abriendolo con google chrome funciona perfectamente. Pero cuando lo compilo con phonegap y lo corro en android, las request GET no se envian. Pulso los switches y los relays no encienden. Alguien sabe a que se debe esto?
Les dejo mi codigo
<span class="switch">
<span class="switch-border1">
<span class="switch-border2">
<input id="switch1" type="checkbox"/>
<label for="switch1"></label>
<span class="switch-top"></span>
<span class="switch-shadow"></span>
<span class="switch-handle"></span>
<span class="switch-handle-left"></span>
<span class="switch-handle-right"></span>
<span class="switch-handle-top"></span>
<span class="switch-handle-bottom"></span>
<span class="switch-handle-base"></span>
<span class="switch-led switch-led-green">
<span class="switch-led-border">
<span class="switch-led-light">
<span class="switch-led-glow"></span>
</span>
</span>
</span>
<span class="switch-led switch-led-red">
<span class="switch-led-border">
<span class="switch-led-light">
<span class="switch-led-glow"></span>
</span>
</span>
</span>
</span>
</span>
</span>
<span class="switch">
<span class="switch-border1">
<span class="switch-border2">
<input id="switch2" type="checkbox" />
<label for="switch2"></label>
<span class="switch-top"></span>
<span class="switch-shadow"></span>
<span class="switch-handle"></span>
<span class="switch-handle-left"></span>
<span class="switch-handle-right"></span>
<span class="switch-handle-top"></span>
<span class="switch-handle-bottom"></span>
<span class="switch-handle-base"></span>
<span class="switch-led switch-led-green">
<span class="switch-led-border">
<span class="switch-led-light">
<span class="switch-led-glow"></span>
</span>
</span>
</span>
<span class="switch-led switch-led-red">
<span class="switch-led-border">
<span class="switch-led-light">
<span class="switch-led-glow"></span>
</span>
</span>
</span>
</span>
</span>
</span>
<script type="text/javascript">
var ip = '192.168.0.104';
function on(id) {
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
var url = "http://"+ip+"/r"+id+"=ON";
xmlhttp.open("GET", url, false);
xmlhttp.send(null);
var respo= xmlhttp.responseText;
}
function off(id) {
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
var url = "http://"+ip+"/r"+id+"=OFF";
xmlhttp.open("GET", url, false);
xmlhttp.send(null);
var respo= xmlhttp.responseText;
}
var checkbox = document.getElementById('switch1');
checkbox.addEventListener("change", comprueba, false);
function comprueba(){
if(checkbox.checked){
on(1);
}else{
off(1);
}
}
var checkbox_2 = document.getElementById('switch2');
checkbox_2.addEventListener("change", comprueba2, false);
function comprueba2(){
if(checkbox_2.checked){
on(2);
}else{
off(2);
}
}