Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Try use Cordova plugins in a iframe

I'm working with Cordova loading a HTML in a iframe. All work fine but I need access to the plugins in the original HTML.
The original code is like this

navigator.camera.getPicture(onSuccess, onFail);

When I load that HTML in a iframe I need make this

parent.navigator.camera.getPicture(onSuccess, onFail);

This code work but I really need don't change the original code. Somebody know how I can use cordova plugins in a iframe ?

like image 815
Mnavarro Avatar asked Aug 14 '14 04:08

Mnavarro


1 Answers

Add the cordova.js link to the html file being loaded into your ifame.

<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
like image 189
tnt-rox Avatar answered Oct 12 '22 11:10

tnt-rox