mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 04:44:08 +02:00
Make WebWindow hyperlinks with target="_blank" open in user's browser
This commit is contained in:
parent
0fb2390877
commit
b1db7e5ed2
1 changed files with 8 additions and 0 deletions
|
@ -32,12 +32,20 @@ void DataWebPage::javaScriptConsoleMessage(const QString& message, int lineNumbe
|
|||
}
|
||||
|
||||
bool DataWebPage::acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, QWebPage::NavigationType type) {
|
||||
// Handle hifi:// links and links to files with particular extensions
|
||||
QString urlString = request.url().toString();
|
||||
if (Application::getInstance()->canAcceptURL(urlString)) {
|
||||
if (Application::getInstance()->acceptURL(urlString)) {
|
||||
return false; // we handled it, so QWebPage doesn't need to handle it
|
||||
}
|
||||
}
|
||||
|
||||
// Make hyperlinks with target="_blank" open in user's Web browser
|
||||
if (type == QWebPage::NavigationTypeLinkClicked && frame == nullptr) {
|
||||
Application::getInstance()->openUrl(request.url());
|
||||
return false; // We handled it.
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue