Js calls OC, to report an error 'messageHandlers' of undefined

I am the front-end js,. I need to use OC to call Android and ios to pass webSend 4 parameters, they do the sharing function, and then return to me whether the sharing is successful.
looked up the method on the Internet, but reported an error Cannot read property "messageHandlers" of undefined, Cannot read property" android" of undefined,. I don"t know where the problem is


<!DOCTYPE html>
<html lang="en">

<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>
Oct.22,2021

where did you read the error report, browser? this means there is no definition. These are Android methods. The browser will definitely report an error. You should put html in native and see if it is compatible with
.

Previous: Rails:undefined method `name' for []: Array

Next: Image size processing in website

Menu