EvaluateJavaScript problem on QML
-
Hi.
Why this code not works?
@
webView.evaluateJavaScript("document.onclick=myfunc;function myfunc(){alert('salam')}")
@The following works well.
@
settings.javascriptEnabled is set to true. webView.evaluateJavaScript("alert('salam')")
@ -
declare your javascript function before calling it :
@
webView.evaluateJavaScript("function myfunc(){alert('salam')};document.onclick=myfunc;");
@ -
Same problem.
-
I solved. The problem was that I called this function on onUrlChanged event. I put it to onLoadingFinished. Now it works well.