Reputation: 1526
I have a phonegap/jQuery Mobile Android app that opens an external URL (which I can't modify its contents) using window.open(URL)
.
The problem is that I can't get it to close and return to the "normal" app, I get the following error in the logcat: Uncaught ReferenceError: cordova is not defined", source: here_goes_the_external_url.html
A little below the logcat shows: "exception firing pause event from native", source: here_goes_the_external_url.html
The thing is that I don't know if the cause is that I'm capturing the "back event" to control exactly what happens when the user presses it, I have this in my onDeviceReady() function: document.addEventListener("backbutton", pressBackButton, false);
Is there a way I can force the back button to close that window? It seems that once it opens that window cordova isn't active anymore (thus the undefined error), but isn't it the point of the inappbrowser, to open it inside the app?
And yes, I forgot to mention, I'm loading the inappbrowser plugin
Upvotes: 1
Views: 984
Reputation: 1526
So looking for an answer I found another thread with a similar problem, and after investigating a bit I found a solution, which I posted as an answer in that other thread: Handle Android Back Button on Phonegap InAppBrowser
If someone else is looking for my answer, go to that link and look for the answer with my username
Upvotes: 1
Reputation: 1319
Try this.
closebuttoncaption closes it
onclick="window.open('https://www.google.com/', '_blank'location=yes','closebuttoncaption=Done');
Upvotes: 0
Reputation: 441
Try removing this
<script type="text/javascript" src="phonegap.js"></script>
And add
<script type="text/javascript" src="cordova.js"></script>
Upvotes: 0