I’m trying to get AJAX calls in the web popup to fire the listener event. They do not, though regular links do and so does the initial showWebPopup function call.
I am testing this by using showAlert on the first line of the listener function:
[lua]local function listener( event )
native.showAlert( “Corona”, event.url, { “OK” } )
return true
end
local options = { hasBackground=true, baseUrl=system.ResourceDirectory, urlRequest=listener }
native.showWebPopup( “main.xml”, options )[/lua]
The javascript I’m using to load the local file is:
[javascript]
function loadXMLDoc(dname)
{
xhttp=new XMLHttpRequest();
xhttp.open(“GET”,dname,false);
xhttp.send("");
return xhttp.responseXML;
}
function displayResult(xmlfile,xslfile)
{
xml = loadXMLDoc(xmlfile);
xsl = loadXMLDoc(xslfile);
xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
var XmlDom = xsltProcessor.transformToDocument(xml);
var serializer = new XMLSerializer();
var output = serializer.serializeToString(XmlDom.documentElement);
document.getElementById(“contentbody”).innerHTML = unescape(output);
}
[/javascript]
This works just fine in both regular Safari, Safari on the device and in the web popup, but it does not fire the listener event.
My idea is to use javascript to load a local file, but have the listener catch the call and, if necessary (depending on parameters passed in the AJAX call) go to the net and download another file, which can then be loaded locally.
Would anyone have any ideas or work arounds?
Thanks,
Matt. [import]uid: 8271 topic_id: 16332 reply_id: 316332[/import]