我正在使用PhoneGap构建Windows Phone 7混合应用程序。 我们正在申请中打开一个子浏览器。
The problem is we are not able to send some data to child browser window from our javascript file.We have tried to use local storage but local storage value are not accessible in child browser.
This is the section of code from where we are opening child browser.(parent browser)
$("#openformbtn").click(function(){
ChildBrowser.install();
localStorage.qString='h=NAS1&t=0000927686:1000&n=abc&e=a@g.com&c=776895654568&hname=mnl&cname=Ahm';
var cb = window.plugins.childBrowser;
cb.showWebPage('x-wmapp1://app/www/payment-info.html',false);
});
});
This code is called in child browser when it gets loaded(child browser)
$(document).ready(function(){
createPaymentInfo();
});
function createPaymentInfo(){
var query= localStorage.qString;
}
答案 0 :(得分:0)
将数据附加到网址。
$("#openformbtn").click(function(){
ChildBrowser.install();
var qString='h=NAS1&t=0000927686:1000&n=abc&e=a@g.com&c=776895654568&hname=mnl&cname=Ahm';
var cb = window.plugins.childBrowser;
var url = 'x-wmapp1://app/www/payment-info.html' + '?' + qString;
cb.showWebPage(url, false);
});
然后在子浏览器中,您可以使用以下代码:
var params = location.href.split('?')[1];
并解析为数组或其他任何内容。