diff --git a/iframeschemehandler.cpp b/iframeschemehandler.cpp index 8a6a79fd..fa98ffb5 100644 --- a/iframeschemehandler.cpp +++ b/iframeschemehandler.cpp @@ -46,9 +46,9 @@ void IframeSchemeHandler::requestStarted(QWebEngineUrlRequestJob *requestJob) QString baseTagHtml = ""; - QString depressionFocus = - QStringLiteral( "" - ""); + QString depressionFocus ="" + "" + ""; // remove existed base tag articleString.remove( baseTag ) ; diff --git a/scripts.qrc b/scripts.qrc index 66bec116..9ceb592f 100644 --- a/scripts.qrc +++ b/scripts.qrc @@ -5,5 +5,6 @@ scripts/gd-builtin.js scripts/gd-custom.js scripts/jquery-3.6.0.slim.min.js + scripts/iframe-defer.js diff --git a/scripts/gd-custom.js b/scripts/gd-custom.js index 2d704864..087e0ac6 100644 --- a/scripts/gd-custom.js +++ b/scripts/gd-custom.js @@ -49,7 +49,7 @@ }); //monitor iframe height. - $('iframe').iFrameResize({ checkOrigin:false,maxHeight :800,scrolling:true,warningTimeout:0,minHeight :250,log:true}); + $('iframe').iFrameResize({ checkOrigin:false,maxHeight :800,scrolling:true,warningTimeout:0,minHeight :250,log:true,autoResize:false}); }); })($_$); diff --git a/scripts/iframe-defer.js b/scripts/iframe-defer.js new file mode 100644 index 00000000..c73c73bb --- /dev/null +++ b/scripts/iframe-defer.js @@ -0,0 +1,13 @@ +setInterval(function () { + //in some cases ,the website in iframe will load result after document has been loaded. the height will continue to change. + const body = document.body; + const html = document.documentElement; + + const height = Math.max(body.scrollHeight, body.offsetHeight, + html.clientHeight, html.scrollHeight, html.offsetHeight); + + if ('parentIFrame' in window) { + console.log("iframe set height to " + height); + parentIFrame.size(height); + } +}, 500); \ No newline at end of file