-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
My english is poor but I hope you can understand :)
There is a web page in my app and I added some example javascript API by using 'WKUserScript' in WKWebView, this web page has a button like this :
"<button onclick="return submitForm()" name="save" class=...."
I add a event listener in connectWebViewJavascriptBridge() :
connectWebViewJavascriptBridge(function(bridge) {
bridge.init(function(message, responseCallback) {
responseCallback("Right back atcha")
})
var elements = document.getElementsByName("save")
var saveBtn = elements[0]
saveBtn.addEventListener("click", function() {
bridge.callHandler('settingPageCallBack', {'foo': 'bar'})
}, false)
})
When I run my app use these javascript code the web page will get stuck when I click save button, but if I delete 'bridge.callHandler('settingPageCallBack', {'foo': 'bar'})' the save button will submit success, I don't know how to fix this, any advice?
Metadata
Metadata
Assignees
Labels
No labels