这个一般是由原生程序注入webview的,大部分webview对象都有一个类似executeJavaScript的方法,例如Android、iOS、Eelctron。 参考一下Electron的webContents: contents.executeJavaScript('fetch("https://jsonplaceholder.typicode.com/users/1").then(resp => resp.json())', true) .then((result) => { console.log(result) // Will be the JSON object from the fetch call })
这个一般是由原生程序注入webview的,大部分webview对象都有一个类似
executeJavaScript
的方法,例如Android、iOS、Eelctron。参考一下Electron的webContents: