Omar Poch
- Forum posts: 1
Dec 2, 2012, 5:07:29 PM via Website
Dec 2, 2012 5:07:29 PM via Website
Hello,
First I must excuse me for my poor English
I have developed a controller device that use jscript to refresh some data in a explorer page
this is the controller link sa712w.dynalias.net
If you use a browser as Firefox, Chrome, IE etc, you can see that are some data refreshed in real time: The temperature and humidity, the time for the next commutation, and the system status. The data is collected from a XML page ( called Variables.xml ) and then I refresh div tags to show the data.
The problem is when use an standard explorer into Android device, this data isn't showed.
I think the problem is the httprequest object creation. I can be mistaken
As this is a controller device, it can not have internet access. It could be connected only to a Lan .
This is the code for parser the page XML.
the file is "func.js"
// these are the variables to refresh
var jsLectTemp;
var jsLectHum;
var jsEstEq1;
var jsEstEq2;
var jsColEstEq1;
var jsColEstEq1;
var jsEstTemp;
var jsEst220;
var jsEstSec;
var jsEstModo;
var jsEstDelaymed;
var jsProxConm;
var jsDivCr1;
var jsDivCr2;
// -----------------------------
var wPagina;
// ----------------------------
// they are the variables to object
var xmlhttp;
var xmlDoc;
function Read_XML_File(pagina)
{
wPagina=pagina;
try {//Test for Internet Explorer
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false; //We want a synchronous connection
xmlDoc.load("variables.xml"); //Load the XML file
}catch(err){ //If ActiveX isn't going to work we use a more codified standard
try {//Every browser but Internet Explorer
xhttp=new XMLHttpRequest();
xhttp.open("GET","variables.xml",false);
xhttp.send("");
xmlDoc=xhttp.responseXML;
}catch(err){ //If that doesn't work, we produce an error .
<!-- alert("Your explorer isn't compatible with IneControl"); -->
return;
}
}
// this is the parser
jsLectTemp = xmlDoc.getElementsByTagName("LectTemp")[0].childNodes[0].nodeValue;
jsLectHum = xmlDoc.getElementsByTagName("LectHum")[0].childNodes[0].nodeValue;
jsEstEq1 = xmlDoc.getElementsByTagName("EstEq1")[0].childNodes[0].nodeValue;
jsEstEq2 = xmlDoc.getElementsByTagName("EstEq2")[0].childNodes[0].nodeValue;
jsEstTemp = xmlDoc.getElementsByTagName("EstTemp")[0].childNodes[0].nodeValue;
jsEst220 = xmlDoc.getElementsByTagName("Est220")[0].childNodes[0].nodeValue;
jsEstSec = xmlDoc.getElementsByTagName("EstSec")[0].childNodes[0].nodeValue;
jsEstModo = xmlDoc.getElementsByTagName("EstModo")[0].childNodes[0].nodeValue;
jsEstDelayMed = xmlDoc.getElementsByTagName("EstDelayMed")[0].childNodes[0].nodeValue;
jsProxConm = xmlDoc.getElementsByTagName("ProxConm")[0].childNodes[0].nodeValue;
jsDivCr1 = xmlDoc.getElementsByTagName("DivCr1")[0].childNodes[0].nodeValue;
jsDivCr2 = xmlDoc.getElementsByTagName("DivCr2")[0].childNodes[0].nodeValue;
document.getElementById("idLectTemp").innerHTML=jsLectTemp;
document.getElementById("idLectHum").innerHTML=jsLectHum;
document.getElementById("idEstEq1").innerHTML=jsEstEq1;
document.getElementById("CeldaEq1").className=jsEstEq1;
document.getElementById("idEstEq2").innerHTML=jsEstEq2;
document.getElementById("CeldaEq2").className=jsEstEq2;
document.getElementById("idEstTemp").innerHTML=jsEstTemp;
document.getElementById("CeldaTemp").className=jsEstTemp;
document.getElementById("idEst220").innerHTML=jsEst220;
document.getElementById("Celda220").className=jsEst220;
document.getElementById("idEstSec").innerHTML=jsEstSec;
document.getElementById("CeldaSec").className=jsEstSec;
document.getElementById("idEstModo").innerHTML=jsEstModo;
document.getElementById("CeldaModo").className=jsEstModo;
document.getElementById("idEstDelay").innerHTML=jsEstDelayMed;
document.getElementById("CeldaDelay").className=jsEstDelayMed;
document.getElementById("idProxConm").innerHTML=jsProxConm;
if (wPagina==='IRLEARN'){
document.getElementById("idDivCr1").innerHTML=jsDivCr1;
document.getElementById("idDivCr2").innerHTML=jsDivCr2;
}
// this is to refresh the data
setTimeout("Read_XML_File(wPagina)",1000);
}
My question is if the xmlDoc is correctly created for android in the .js file
Thank you in advance
Omar
First I must excuse me for my poor English
I have developed a controller device that use jscript to refresh some data in a explorer page
this is the controller link sa712w.dynalias.net
If you use a browser as Firefox, Chrome, IE etc, you can see that are some data refreshed in real time: The temperature and humidity, the time for the next commutation, and the system status. The data is collected from a XML page ( called Variables.xml ) and then I refresh div tags to show the data.
The problem is when use an standard explorer into Android device, this data isn't showed.
I think the problem is the httprequest object creation. I can be mistaken
As this is a controller device, it can not have internet access. It could be connected only to a Lan .
This is the code for parser the page XML.
the file is "func.js"
// these are the variables to refresh
var jsLectTemp;
var jsLectHum;
var jsEstEq1;
var jsEstEq2;
var jsColEstEq1;
var jsColEstEq1;
var jsEstTemp;
var jsEst220;
var jsEstSec;
var jsEstModo;
var jsEstDelaymed;
var jsProxConm;
var jsDivCr1;
var jsDivCr2;
// -----------------------------
var wPagina;
// ----------------------------
// they are the variables to object
var xmlhttp;
var xmlDoc;
function Read_XML_File(pagina)
{
wPagina=pagina;
try {//Test for Internet Explorer
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false; //We want a synchronous connection
xmlDoc.load("variables.xml"); //Load the XML file
}catch(err){ //If ActiveX isn't going to work we use a more codified standard
try {//Every browser but Internet Explorer
xhttp=new XMLHttpRequest();
xhttp.open("GET","variables.xml",false);
xhttp.send("");
xmlDoc=xhttp.responseXML;
}catch(err){ //If that doesn't work, we produce an error .
<!-- alert("Your explorer isn't compatible with IneControl"); -->
return;
}
}
// this is the parser
jsLectTemp = xmlDoc.getElementsByTagName("LectTemp")[0].childNodes[0].nodeValue;
jsLectHum = xmlDoc.getElementsByTagName("LectHum")[0].childNodes[0].nodeValue;
jsEstEq1 = xmlDoc.getElementsByTagName("EstEq1")[0].childNodes[0].nodeValue;
jsEstEq2 = xmlDoc.getElementsByTagName("EstEq2")[0].childNodes[0].nodeValue;
jsEstTemp = xmlDoc.getElementsByTagName("EstTemp")[0].childNodes[0].nodeValue;
jsEst220 = xmlDoc.getElementsByTagName("Est220")[0].childNodes[0].nodeValue;
jsEstSec = xmlDoc.getElementsByTagName("EstSec")[0].childNodes[0].nodeValue;
jsEstModo = xmlDoc.getElementsByTagName("EstModo")[0].childNodes[0].nodeValue;
jsEstDelayMed = xmlDoc.getElementsByTagName("EstDelayMed")[0].childNodes[0].nodeValue;
jsProxConm = xmlDoc.getElementsByTagName("ProxConm")[0].childNodes[0].nodeValue;
jsDivCr1 = xmlDoc.getElementsByTagName("DivCr1")[0].childNodes[0].nodeValue;
jsDivCr2 = xmlDoc.getElementsByTagName("DivCr2")[0].childNodes[0].nodeValue;
document.getElementById("idLectTemp").innerHTML=jsLectTemp;
document.getElementById("idLectHum").innerHTML=jsLectHum;
document.getElementById("idEstEq1").innerHTML=jsEstEq1;
document.getElementById("CeldaEq1").className=jsEstEq1;
document.getElementById("idEstEq2").innerHTML=jsEstEq2;
document.getElementById("CeldaEq2").className=jsEstEq2;
document.getElementById("idEstTemp").innerHTML=jsEstTemp;
document.getElementById("CeldaTemp").className=jsEstTemp;
document.getElementById("idEst220").innerHTML=jsEst220;
document.getElementById("Celda220").className=jsEst220;
document.getElementById("idEstSec").innerHTML=jsEstSec;
document.getElementById("CeldaSec").className=jsEstSec;
document.getElementById("idEstModo").innerHTML=jsEstModo;
document.getElementById("CeldaModo").className=jsEstModo;
document.getElementById("idEstDelay").innerHTML=jsEstDelayMed;
document.getElementById("CeldaDelay").className=jsEstDelayMed;
document.getElementById("idProxConm").innerHTML=jsProxConm;
if (wPagina==='IRLEARN'){
document.getElementById("idDivCr1").innerHTML=jsDivCr1;
document.getElementById("idDivCr2").innerHTML=jsDivCr2;
}
// this is to refresh the data
setTimeout("Read_XML_File(wPagina)",1000);
}
My question is if the xmlDoc is correctly created for android in the .js file
Thank you in advance
Omar
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.