javascript - I Need create an html page that reads a XML file in a CD-R. How I can do that? -


i made html website running in cd-r (this manual). have page created , working good, @ moment i'm having problems opening xml file.

my question is, possible, since running in cd drive? thank you

this have:

function testing() {     var rawfile = new xmlhttprequest();     rawfile.open("get", "teste.txt", true);     rawfile.onreadystatechange = function ()     {         if(rawfile.readystate === 4)         {             var alltext = rawfile.responsetext;             alert(alltext);         }         else             alert("erro no xml");     }      rawfile.send(); } 

this works fine in example: localhost/path want work in path c:\path\

if don't mind modifying source files little bit turning json, use jsonp. here's simple example:

<button onclick="go();">click me</button> <script type="text/javascript">     function go() {         var scripttag = document.createelement("script");         scripttag.src = "sometext.js";         document.getelementsbytagname("body")[0].appendchild(scripttag);     }     function jsoncallback(txt) {         console.log(txt);     } </script> 

file: sometext.js:

jsoncallback("hello world!"); 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -