客户端触发 WebView事件

客户端触发 WebView事件

原理很简单,客户端load一段js代码。js代码里新建相应的事件,然后 dispatchEvent

// Maybe you want to fire an event to the web view when it's started
		webview.loadUrl("javascript:var ev = document.createEvent('Events');ev.initEvent('myplugin.workstart',true,true);document.dispatchEvent(ev);");

你可能感兴趣的:(JavaScript,webView,dispatchEvent)