0

I am building a Windows Phone 7 hybrid application using PhoneGap. We are opening a child browser in our application.

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;
     }
user1533947
  • 197
  • 1
  • 1
  • 7

1 Answers1

0

Append the data to the url.

$("#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);       
});

Then inside the child browser you can have some code like:

var params = location.href.split('?')[1];

and parse into an array or whatever from there.

Uncharted Space
  • 861
  • 7
  • 13
  • I have already tried this solution.The child browser displays an error as : "We're having trouble displaying this web page" and a navigation error comes. – user1533947 Apr 19 '13 at 06:39
  • hey it worked .I tried this link and first solution worked. http://stackoverflow.com/questions/13577114/how-to-pass-a-parameter-to-a-local-html-page-in-wp7-wp8 – user1533947 Apr 19 '13 at 07:42