I created a mobile application based on iOS platform and Android platform using cordova.I want to set it`s content to an external web site page, so I don't need to update every mobile device, just to update the page on the server。
At first I set external page as cordova starting page: loadUrl("http://www.mywebsite.com/index.html")
. The app could run but use cordova API failed.
Then I use local web page as starting page, add the external web link to navigate to the external page. The app still can`t use cordova API.
I try to use cordova inappbrowser plugin, but I noticed that it has a comment : The InAppBrowser window behaves like a standard web browser, and can't access Cordova APIs. For this reason, the InAppBrowser is recommended if you need to load third-party (untrusted) content, instead of loading that into the main Cordova webview. The InAppBrowser is not subject to the whitelist, nor is opening links in the system browser.
I found some app has the function which external web page use device camera or record sound just like cordova, but I`m not sure it uses cordova or its own framework.
Is there any way to use the Cordova API in an external web page?
Do you have following lines into your config xml?
<content src="[YOUR URL]"/>
<access origin="*" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<allow-navigation href="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
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