Calling Phonegap/Cordova plugin functions from remote web page

柔情痞子 提交于 2019-12-14 02:15:27

问题


I'm loading a remote page into a Cordova app using:

window.location = "http://myfoosite.net"

The local Cordova app has some plugins set up and the remote page has cordova.js loaded into it. It seems to work fine as I can hook in to the deviceready event on the remote page and add an EventListener for 'backbutton', for example.

If I call out to a plugin locally, it works fine:

 navigator.notification.alert("wooo", null);

... but not from the remote page.

Is there any way to call out to plugins from remote pages?


回答1:


it is not possible to call cordova plugins call in remote pages. but you can make use of Inappbrowser phonegap plugin to implement this.

Inappbrowser provide callback function which you can you use as per requirement.

For more info on this go to below url

http://docs.phonegap.com/en/3.0.0/cordova_inappbrowser_inappbrowser.md.html

Hope this helps.. Thanks



来源:https://stackoverflow.com/questions/23913936/calling-phonegap-cordova-plugin-functions-from-remote-web-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!