Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/93.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在phonegap IOS中从IFrame访问cordova函数_Ios_Iframe_Cordova_Cordova 3_Inappbrowser - Fatal编程技术网

如何在phonegap IOS中从IFrame访问cordova函数

如何在phonegap IOS中从IFrame访问cordova函数,ios,iframe,cordova,cordova-3,inappbrowser,Ios,Iframe,Cordova,Cordova 3,Inappbrowser,在我的Phonegap ios项目中,我有一个i框架,Iframe的src是同一个www文件夹中的本地html页面。在html(IFrame源代码)中,单击一个按钮,然后单击“侦听器”。在应用浏览器或safari(新窗口)中单击该按钮时,我需要打开一个网站。我无法从html文件(IFrame源)访问phonegap方法,我在两个html文件中都包含cordova,我的源html页面如下所示,此页面显示在IFrame中 <html> <head> <script

在我的Phonegap ios项目中,我有一个i框架,Iframe的src是同一个www文件夹中的本地html页面。在html(IFrame源代码)中,单击一个按钮,然后单击“侦听器”。在应用浏览器或safari(新窗口)中单击该按钮时,我需要打开一个网站。我无法从html文件(IFrame源)访问phonegap方法,我在两个html文件中都包含cordova,我的源html页面如下所示,此页面显示在IFrame中

<html>

<head>

<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script src="js/libs/jquery.js"></script>
<script src="adv.js"></script>

<script>


  $(document).ready(function () {

      $('#advArea').find('button').on('click', function (e) {
                                 e.preventDefault();
                                 var path = "http://www.google.com");

                                 console.log(path);
                                 //window.open(path,'__system');
                                 //need to acces inApp Browser from here

                                 })

  });

</script>
</head>

<body>
<div id="advArea">

 <button></button>
  </div>
</body>

</html>

$(文档).ready(函数(){
$('advArea')。查找('button')。打开('click',函数(e){
e、 预防默认值();
变量路径=”http://www.google.com");
console.log(路径);
//打开(路径,“系统”);
//需要从此处访问inApp浏览器
})
});
在iFrame所在的“父”页面中,创建以下函数

function popnew(path) {
        navigator.app.loadUrl(link, { 'openExternal' : true });
    }
然后为iFrame中的任何按钮/链接调用上述函数

<button onclick="javascript:parent.popnew('http://www.stackoverflow.com')"></button>