diff --git a/src/lib/webengine/webpage.cpp b/src/lib/webengine/webpage.cpp index 74fafd3e8..345e8053e 100644 --- a/src/lib/webengine/webpage.cpp +++ b/src/lib/webengine/webpage.cpp @@ -377,7 +377,15 @@ bool WebPage::acceptNavigationRequest(const QUrl &url, QWebEnginePage::Navigatio return false; } - return QWebEnginePage::acceptNavigationRequest(url, type, isMainFrame); + const bool result = QWebEnginePage::acceptNavigationRequest(url, type, isMainFrame); + + if (result && isMainFrame) { + const bool isWeb = url.scheme() == QL1S("http") || url.scheme() == QL1S("https"); + const bool globalJsEnabled = mApp->webSettings()->testAttribute(QWebEngineSettings::JavascriptEnabled); + settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, isWeb ? globalJsEnabled : true); + } + + return result; } bool WebPage::certificateError(const QWebEngineCertificateError &error)