0
votes

I'm trying to load an external page with my phonagap appication but when I'm using the back button to return to my application the javascript and css are not load.

My application looks like this one: http://coenraets.org/blog/2011/10/sample-application-with-jquery-mobile-and-phonegap/

I include all my scripts and css in the index.html and not in the others pages.

I'm just using a link like that to go to an external link:

<a href="http://www.stackoverflow.com" >Test</a>

Thanks for your help

2

2 Answers

1
votes

I like the Childbrowser (CB) plugin (or the inAppBrowser):

If this is your link, add a class such as "extLink"

< a href="#" class="extLink">Test< /a>

Then bind to the click event for anything that has that class and open in CB Window:

$(".extLink").on('click', function(event){ window.plugins.childBrowser.showWebPage('http://www.stackoverflow.com/', { showNavigationBar: true });

Or you can use the inAppBrowser (Cordova/PG 2.3+)

$(".extLink").on('click', function(event){
var ref = window.open('http://www.stackoverflow.com/', '_blank', 'location=yes')});

1
votes

You can use phonegap's InAppBrowser API.

http://docs.phonegap.com/en/2.4.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser

This will lead to returning to the application without reloading the scripts and css.