From 5c9b6b0171a503a01634c2cf3320605ddf955aec Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Fri, 2 Sep 2022 21:27:25 +0800 Subject: [PATCH] forbid iframe focus operation --- iframeschemehandler.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/iframeschemehandler.cpp b/iframeschemehandler.cpp index 63d6d081..a4bf4bd3 100644 --- a/iframeschemehandler.cpp +++ b/iframeschemehandler.cpp @@ -45,6 +45,9 @@ void IframeSchemeHandler::requestStarted(QWebEngineUrlRequestJob *requestJob) QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption ); QString baseTagHtml = ""; + + QString depressionFocus = + ""; // remove existed base tag articleString.remove( baseTag ) ; @@ -56,12 +59,14 @@ void IframeSchemeHandler::requestStarted(QWebEngineUrlRequestJob *requestJob) if( match.hasMatch() ) { articleString.insert( match.capturedEnd(), baseTagHtml ); + articleString.insert( match.capturedEnd(), depressionFocus ); } else { // the html contain no head element // just insert at the beginning of the html ,and leave it at the mercy of browser(chrome webengine) articleString.insert( 0, baseTagHtml ); + articleString.insert( 0, depressionFocus ); } buffer->setData(codec->fromUnicode(articleString));