appcan.windw.open appcan.frame.open appcan.window.openPopOver evaluateScript

在模拟器上,几种发方式产生的窗口,其实都是iframe。

在根窗口(app打开的第一个)执行JS:

try{
                appcan.window.evaluateScript(
                    {
                        name:   'root',
                        scriptContent:"alert(321)",
                        type:0
                    }
                );
            }catch(e){
                alert("es1.0: "+e);
            }

在window.frame打开的窗口执行:

try{
                appcan.frame.evaluateScript(
                    {
                        popName:'content',
                        scriptContent:"opennerFunc1(321)"
                    }
                );
            }catch(e){
                alert("es1.0: "+e);
            }



 appcan.frame.close:

如果是在要被关闭的窗口发起调用关闭自己,是不行的,需要加个setTimeout

原文地址:https://www.cnblogs.com/lein317/p/5067523.html