Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing Plugins #30

Open
MichaelTague opened this issue Jul 19, 2017 · 4 comments
Open

Accessing Plugins #30

MichaelTague opened this issue Jul 19, 2017 · 4 comments

Comments

@MichaelTague
Copy link

MichaelTague commented Jul 19, 2017

Hi, I'm trying to use a webview to load an external URL and to let that loaded page/js invoke a plugin.

I can load the page simply enough: webview.Show(URL), and it correctly displays and can load JS and CSS - basically works as expected. I've included in the directory of my HMTL the cordova.js file. This makes the "cordova" varable present and even cordova.exec. But, when I try this:

cordova.exec(null, null, "Vibration", "vibrate", [1000]);

It doesn't produce any errors, but nothing vibrates either. I've tried other plugins as well. All are included in my calling application. I've even included the other files/dirs of a cordova app: cordova_plugins.js, cordova-js-src, & plugins but nothing happens.

Does anyone have a suggestion of what I might be missing? Or an example of where this works?

@dullpage
Copy link

dullpage commented Nov 5, 2017

I created a webview using webview.Show(URL), when I type the command "device", it returns:
Device {available: false, platform: null, version: null, uuid: null, cordova: null…}

In Ionic main webview, the same "device" command returns:
Device {available: true, platform: "Android", version: "6.0", uuid: "3b2ce5690725976c", cordova: "6.1.2"…}

It will be appreciated if you could provide a simple example to access cordova plugin from the webview.

@vespino
Copy link

vespino commented Nov 30, 2017

@dullpage did you manage to get this working? I'm also looking for a way to access native plugins on the website I'm opening with webview.Show();

@Edc-zhang
Copy link

I use this plugin in my ionic3 project,after open second webview can invoke cordova plugin as expected.

@naushrambo
Copy link

naushrambo commented Sep 14, 2019

Can't access any cordova plugin or variable from second webview.
Did anyone has working example.

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    webview.Show("https://www.myweblink.com");
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants