Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Cordova and his plugins on a remote url

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 ?

like image 725
Tahola Avatar asked Mar 23 '15 06:03

Tahola


People also ask

How to install Cordova plugins?

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 ...

How to integrate Cordova with a WebView?

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.

Should I use a Cordova app to load a remote website?

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.

What API features are available in Cordova?

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.


1 Answers

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.

like image 71
Tahola Avatar answered Sep 18 '22 23:09

Tahola