如何从javaScript调用python或java方法

How can i call python or java method from javaScript?

本文关键字:java 方法 python 调用 javaScript      更新时间:2023-09-26
if (agentType == "IOS") {
    apiVersion = requestJsonObj.version;
    httpClient = {
        httpGet: function (requestUrl, user_agent) { 
            return httpRequest(requestUrl, user_agent);
        }
    }
}else if(agentType == "Android"){
    if(apiVersion>apiVersion_LastOld){
        httpClient = {
            httpGet: function (requestUrl, user_agent) {
                return result=com.esvideo.parse.util.ParseHttpUtil.httpGet(requestUrl, user_agent)+"";
            }
        }
    }
}

有人用JavaScript编写了这段代码,但我不知道它是如何工作的。

你不能。默认情况下,iOS设备上没有安装Python解释器,Android上的Dalvik(不是Java!)运行时不会暴露在网页上。