I'm using JBCefBrowser for build my application (IntelliJ plugin). I need to handle button or link click in Java code (not JavaScript). Could someone give an advice how to do this?
Thank you!
I'm using JBCefBrowser for build my application (IntelliJ plugin). I need to handle button or link click in Java code (not JavaScript). Could someone give an advice how to do this?
Thank you!
val javaScriptEngineProxy: JBCefJSQuery = JBCefJSQuery.create(browser as JBCefBrowserBase)
javaScriptEngineProxy.addHandler { result ->
println(result)
null
}
val injectedJavaScript = """
window.goToLine = function() {
var filePath = document.getElementById("go-to-filepath").value
var lineNumber = document.getElementById("go-to-line-number").value
var goToPath = filePath + ":" + lineNumber
${javaScriptEngineProxy.inject("goToPath")}
}
""".trimIndent()
browser.cefBrowser.executeJavaScript(injectedJavaScript, browser.cefBrowser.url, 0)