You need to be logged in to post in the forums. If you do not have an account, please sign up first.
connecting with XML
Hi, I'm trying to load an "xml" in my HTML app. But its not working in TV emulator.I'm new to Tv app development. Please help me to solve my issue..
this is my code...
function loadXML(){
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","http://192.168.75.80/xml/books.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
alert(xmlDoc.getElementsByTagName("book")[1].attributes.getNamedItem("id").nodeValue);
alert(xmlDoc.getElementsByTagName("book")[1].getElementsByTagName("author")[0].childNodes[0].nodeValue);
//xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName("author");
document.write(x[1].childNodes[0].nodeValue);
}
Please help me..
Thanks and Regards,
Suresh J David.
Does your server you are sending querry to handles CORS?
For more information, please check: http://dev.opera.com/articles/view/dom-access-control-using-cross-origin-resource-sharing/
For more information, please check: http://dev.opera.com/articles/view/dom-access-control-using-cross-origin-resource-sharing/
Originally posted by lbendig:
Does your server you are sending querry to handles CORS?
For more information, please check: http://dev.opera.com/articles/view/dom-access-control-using-cross-origin-resource-sharing/
Thanks for your reply. I have read the article.
According to my understanding we need to add "Access-Control-Allow-Origin: *" to somewhere. I didnt get properly where we need to add it either our xml file or any other configuration file which is in application server or virtual machine server?
Could you please clarify my questions?
Thanks,
Suresh J David
Maybe this page will be helpful for you, there is tutorial how to enable CORS on various web servers: http://enable-cors.org/
Originally posted by lbendig:
Maybe this page will be helpful for you, there is tutorial how to enable CORS on various web servers: http://enable-cors.org/
cors is activated, and if i try the URL directly in the address bar, the XML is viewing properly in the operaTV emulator browser, But if i do the same within the application. It given no result. The issue is still open. Please help me what i've to do next.
The application run in chrome, opera, firefox browsers in local system, and perfectly run in opera browser within the emulator if i directly run the application,
but the application is not running from the "mydata" application. Please clarify me..
Thanks,
For 3.3 there should not be any problems (problems could be in 3.1 since CORS is not supported in the older version, so if you e.g. have TV Emulator 3.3 but you have selected 3.1 in web remote control setting, the CORS would not work for you - old cross-domain hecking mechanizm is used instead).
I've just tested CORS wit 3.3 version and everything works fine for me, it's difficult to tell me then what's the problem you have. Could you give more details, e.g. what is the code you use, how you set your web server, etc.?
I've just tested CORS wit 3.3 version and everything works fine for me, it's difficult to tell me then what's the problem you have. Could you give more details, e.g. what is the code you use, how you set your web server, etc.?
Can you test this page in emulator? https://test-cors.appspot.com/#technical
All tests passed for me.
All tests passed for me.
Forums » Dev.Opera » Opera TV Content Development Discussions