醒着星星
醒着星星
  • 发布:2016-09-20 14:42
  • 更新:2017-12-28 00:24
  • 阅读:2099

SDK.obtainWebview(appID, webviewID) 如何获取到这个webviewID呢

分类:5+ SDK

html页面跳转关系如下

guild.html-->login.html-->home.html

我在home.html里的plusready事件里写入

var ws=plus.webview.currentWebview();  
ws.id="home";

原生是做的socket服务,示例代码如下

//收到推送消息后,调用home页的js方法:aaa()  
IWebview homeView=SDK.obtainWebview(appID, “home”);  
homeView.evalJS("aaa()");

homeView获取为null的。

请问大牛们,你们原生调用JS是怎么通过ID定位webview的。
webview的ID是怎么设置的?

不胜感谢。

2016-09-20 14:42 负责人:无 分享
已邀请:
归船

归船

IWebview homeView=SDK.obtainWebview(appID, “home”);
上面这种webview为null

    private static IWebview getWebview(String webviewId) {  
        String currentAppId = SDK.obtainCurrentRunnbingAppId();  
        List<IWebview> list = SDK.obtainAllIWebview(currentAppId);  
        for (IWebview web: list) {  
            String fid = web.obtainFrameId();  
            if (fid.equals(webviewId))  
                return web;  
        }  
        return null;  
    }
小伙灬

小伙灬

解决了么?

r***@163.com

r***@163.com

没有官方的人能够回答一下,接口你们可是写出来,可是没有说怎么用

r***@163.com

r***@163.com

传入的webviewID是webviewUUID,应该是官方代码问题,一楼是正解

该问题目前已经被锁定, 无法添加新回复