class QMyWebPage : public QwebPage { protected: bool acceptNavigationRequest ( QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type ); ... ... }; QMyWebPage::acceptNavigationRequest ( QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type ) { if( type == QWebPage::NavigationTypeFormSubmitted ) { QString str = url = request.url().path(); // 如果是特定的目标 if( str == “http://xxxx.com/update/Firmware.bin” ) { // 从 link 中获取 Firmware 地址 get Firmware addr from path // 下载 Firmware download Firmware // 更新设备 Firmware update Firmware // 返回 false 让浏览器不再处理这个 request return false; } } return QWebPage::acceptNavigationRequest ( frame, request , type ); } |