I like to use Cordova and InAppBrowser plugin with a remote webapp, on oppening my application load an external webapp like this <content src="http://mywebapp.domain.com" />
but with this method i dont have access to any plugins.
So i also tried with jquery :
config.xml
<content src="index.html" />
<access origin="*" />
index.html :
<div id="remoteframe"></div>
$('#remoteframe"').load('http://mywebapp.domain.com');
With this i have access to cordova and all the plugins but the rooting inside of http://mywebapp.domain.com dont work anymore (no css, no js, no route..) and the method look very "dirty".
Is there a proper way to do this ?
Installing Cordova Plugins 1 We can add the required platforms where our app runs. Before doing this, we must have to change our default directory to... 2 Now, search the plugins that you require and install them by using the below commands: More ...
Injects cordova and installed plugin JS into the webview for any remotely browsed page allowing them the same access to the cordova object and its plugins as a packaged cordova app. After a developer defined interval will prompt the user if the loading of the main site is taking too long.
When compared with a cordova app that packages its HTML the downside to loading a remote site is if the network is down your app is down. This can be an acceptable trade off if your site has a heavy dependency on web services.
All the main Cordova API features are implemented as plugins, and many others are available that enable features such as bar code scanners, NFC communication, or to tailor calendar interfaces. You can search for available plugins on Cordova Plugin Search page.
So I finally found, I had to include this on my remote page (http://mywebapp.domain.com) :
<script src="/js/cordova.js"></script>
<script src="/js/inappbrowser.js"></script>
And apparently cordova_plugins.js
must be in the /js/ folder to (same folder as cordova.js).
For multiplaforms you may need to change with the right cordova.js.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With