Quantcast
Channel: Qt DevNet forums: Qt WebKit
Viewing all articles
Browse latest Browse all 542

execution of a JavaScript function into WebView

$
0
0
Into an application that use a WebView I am loading some web content. Trying to execute a JavaScript code that call a alert() window directly into evaluateJavaScript() is fine, but calling it into a function it fails and I am interest into some functions execution into my application. QString strTest1 ("alert(\"this is sly!\"); null "); QVariant f1result = webView->page()->mainFrame()->evaluateJavaScript( strTest1 );  // fine QString strTest2 ("function alert_something() { alert(\"this is sly!\"); } "); QVariant f2result = webView->page()->mainFrame()->evaluateJavaScript( strTest2 );  // bad   qDebug() << f2result.toString(); // returns nothing I can’t figure why calling that trivial function call fails… Ideas? I’m open to alternatives, too.

Viewing all articles
Browse latest Browse all 542

Trending Articles