Cross-domain woes!!!

41 views
Skip to first unread message

skye riquelme

unread,
Nov 22, 2012, 7:09:28 AM11/22/12
to tiddl...@googlegroups.com
Hi All

I have a eLearning platform running fairly well directly online, based on UploadPlugin and the use of some php scripts to store online data in simple txt files....

Now I need to consider students who do not have continual online access (still quite a reality in Brasil) and who need to study using my platform in offline (USB) mode. My thinking is that when a student is connected, to download the server-side txt files to the USB (probably svae them in localStorage as well)........ to store offline additions in another localStorage and to re-integrate this new data when the student re-connects.

My problem is downloading the server-side txt files to a local TW - seems I am hitting cross-domain problems.

Online I use a code like -
<script>
var out="";
  var xmlHttp = null;
    xmlHttp = new XMLHttpRequest();
    var discFile="/someTextFile.txt";
    xmlHttp.open( "GET",discFile, false);
    xmlHttp.send( null );
    var returnText =xmlHttp.responseText;
var lines=returnText.split("#\n");........

to get the data from the txt file....but using this from the offline TW does not work.....the data is not passed to the offline TW !!!

How to get around this? How to get the txt data from the server to the offline TW???

Thanks in Advance
Skye


skye riquelme

unread,
Nov 22, 2012, 8:02:29 PM11/22/12
to tiddl...@googlegroups.com
Hi Again...still trying to sort this out -   I read in another thread, that since I am trying to read from a local file...I shouldn´t be having cross-domain issues..... so....

Im the online TW I have the code

<script>
var out="";
  var xmlHttp = null;
    xmlHttp = new XMLHttpRequest();
    var discFile="/AAA/alunoParticipation.txt";

    xmlHttp.open( "GET",discFile, false);
    xmlHttp.send( null );
    var returnText =xmlHttp.responseText;
................</script>

it works....

but when I put the same code, but with an external url..like this...

<script>
var out="";
  var xmlHttp = null;
    xmlHttp = new XMLHttpRequest();
    var discFile="http://my domain/AAA/alunoParticipation.txt";

    xmlHttp.open( "GET",discFile, false);
    xmlHttp.send( null );
    var returnText =xmlHttp.responseText;
................</script>

I get the message - [Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: file:///X:/Documents/Dropbox/beta.htm :: _out :: line 9681" data: no]

Anyone have ideas whats happening...whay cant I read from a local file???

Thanks in Advance
Skye
Reply all
Reply to author
Forward
0 new messages