Page 1 of 1
window.open problem
Posted: Sun Jun 17, 2012 9:45 am
by zeroonea
When I using window.open('[url=http://rere.vn')]http://rere.vn')[/url], it call a stock browser of my android fone. It is not display the site embedded in app. Is it normal? How to open an url inside app. I don't want open an url in other browser.
window.open problem
Posted: Sun Jun 17, 2012 4:52 pm
by maxkatz
To open a page within your app, use PhoneGap's child browser:
code
var childBrowser = ChildBrowser.install();
window.plugins.childBrowser.showWebPage('http://google.com');
/code
window.open problem
Posted: Fri Aug 10, 2012 5:22 am
by Michael495572
Hi Max.
I can't seem to get the JS you posted to work. If I include the var childBrowser line in an event on load of my screen, the app just hangs both in the web preview and ios preview.
window.open problem
Posted: Fri Aug 10, 2012 3:24 pm
by maxkatz
window.open problem
Posted: Tue Aug 20, 2013 6:58 am
by Toblerone
This code does not work, it does nothing on button click
window.open problem
Posted: Tue Aug 20, 2013 10:56 am
by Kateryna Grynko
Hi,
ChildBrowser is a PhoneGap plug-in that works for installed ipa/apk only, but not on browser.
Create new JavaScript asset with the following code:
codefunction myNavigate(url) {
var cb;
if (window.plugins) {
cb = window.plugins.childBrowser;
}
if (cb != null) {
cb.showWebPage(url);
} else {
window.open(url);
};
}/code
On Click event instead of code:
codevar childBrowser = ChildBrowser.install();
window.plugins.childBrowser.showWebPage('http://...');/code
run:
codemyNavigate('http://...');/code