You need to implement a
custom URL scheme
.
You'd then embed a link with a scheme which is unique to your app such as:
myappname://information/to/be/passed/back
When your application installs the manifest tells the operating system which URL schemes your application wants to accept. The OS then starts listening for you and automatically loads your applications, passing in the full URL, when an appropriate URL is clicked/tapped.
A browser for example doesn't register a custom scheme. It registers
http
and
https
. This is how the operating system knows to give you a choice of browser when you click standard web links in content such as e-mail e.t.c.
This process is similar on both Android and iOS and luckily there's a plugin which standardises the API and simplifies this process for PhoneGap/Cordova.
EddyVerbruggen/Custom-URL-scheme · GitHub[
^]
On a side note - You should never load externally hosted web content directly into the Cordova WebView. On iOS this is likely to get your application submission rejected.
Loading external webpages into your applications Cordova WebView gives that page full access to the device (Within the scope of the applications permissions).
If you need to load an externally hosted web pages you should exit to the system browser or if appropriate use the PhoneGap InAppBrowser.
InAppBrowser - Apache Cordova[
^]
Alternatively if you're just looking to get content from the server to embed in your application then I'd just use AJAX to get the content and javascript to manage the view update. This gives you the benefit of being able to catch failed requests without your application crashing out with a 500, 404 or some other standard HTTP response error from which your user may not be able to recover from.