Is it possible to serve a string via a URL request from one Javascript to another? -


i not sure ask possible @ all, maybe able give me ideas...

here situation. have third-party javascript module being run in browser. module exposes api call loads configuration (xml file) provided url. pass instead xml generate in own script. cannot change module; so, looking way specify url serve local data. there way this?

testing "javascript:" pseudo protocol didn't work - making xmlhttprequest not accept "pseudo" protocols.

testing data uris did work:

var xmlsource = `<?xml version="1.0" encoding="utf-8"?> <text> <para>hello world</para> </text> `; var xmldataurl = "data:text/xml," + xmlsource;  loadconfig( xmldataurl); 

was succesfully sent using dummy version of loadconfig:

// dummy loadconfig: function loadconfig( url) {  var req = new xmlhttprequest();    req.open("get", url);    req.onreadystatechange = function ()    {   if( req.readystate == 4)            console.log(req.responsetext);    };    req.send(); } 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -