+1  A: 

If you are using Qt 4.5 do it something like this:

htmlView->page()->mainFrame()->evaluateJavaScript("add_message(); null");

Note: null at the end of script is for performance issue. QWebFrame::evaluateJavaScript returns QVariant with last value in the script. Evaluating last value in the script may be really time consuming, so putting null at the end makes it return immediately.

Kamil Klimek
Thanks, I'll try it right away when I get home.Although that looks like I have to escape the arguments to use them as literals in the evaluateJavaScript() call. Isn't that dangerous or something?
BastiBense
Yes, you have to escape arguments, becouse JavaScript will generate errors. It shouldn't be dangerouse, becouse you escape it only for JavaScript parser, iniside of webkit it will appear same as unescaped parameter
Kamil Klimek