我是前端js,需要通过OC调用安卓和ios的方法传webSend传4个参数,他们做分享功能,然后返回我是不是分享成功了。网上查了方法,但是报错 Cannot read property 'messageHandlers' of undefined, Cannot read property 'android' of undefined,不知道是哪里的问题<!DOCTYPE html><html><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title></head><body> <button type="button" onclick="shareInformation()">分享</button></body><script> function callback(data) { //分享结果 } function shareInformation() { var lcon = { title: document.title, content: '分享的内容', url: window.location.href, imageUrl: 'https://www.baidu.com/', cb: 'callback' } window.webkit.messageHandlers.webSend.postMessage(lcon); android.webSend(lcon); }</script></html>
添加回答
举报
0/150
提交
取消