【发布时间】:2014-07-04 06:47:13
【问题描述】:
我尝试运行它,但没有任何反应。
void MainWindow::on_pushButton_2_clicked()
{
ui->webView->load(QUrl("javascript:alert('hello world')"));
}
但如果我从 html 文件中加载 javascript 它就可以了。
<a href="javascript:alert('hello world');">Click here to say hi</a>
我知道我可以从 html 文件运行 javascript,但是我的问题是如何使用按钮将 javascript 注入 webview
【问题讨论】:
标签: javascript html qt qtwebkit qwebview