fix: qt6.2 iframe can not access gdlookup built-in javascript

it throw CORS exception in the devtool console  windows.
This commit is contained in:
YiFang Xiao 2022-04-17 22:28:14 +08:00
parent 15702d860b
commit 376f0f1c62
2 changed files with 23 additions and 14 deletions

View file

@ -44,6 +44,27 @@ $(function() {
});
//monitor iframe height.
$( "iframe" ).on( "load", function() {
var iframe = $( this );
resizeIframe( iframe[ 0 ] );
} );
function resizeIframe(obj) {
setInterval(function(){
//in some cases ,the website in iframe will load result after document has been loaded. the height will continue to change.
if($(obj).contents().height() <2000)
{
$(obj).height($(obj).contents().height());
}
else{
$(obj).height(2000);
obj.scrolling="yes";
}
},500);
}
});
})($_$);
@ -52,16 +73,4 @@ function playSound(sound) {
a.play();
}
function resizeIframe(obj) {
setInterval(function(){
//in some cases ,the website in iframe will load result after document has been loaded. the height will continue to change.
if(obj.contentWindow.document.documentElement.scrollHeight <1000)
{
obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + 'px';
}
else{
obj.style.height ='1000px'
obj.scrolling="yes";
}
},500);
}

View file

@ -376,7 +376,7 @@ sptr< DataRequest > WebSiteDictionary::getArticle( wstring const & str,
"\" onmouseover=\"processIframeMouseOver('gdexpandframe-" + getId() + "');\" "
"onmouseout=\"processIframeMouseOut();\" "
"scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" "
"frameborder=\"0\" vspace=\"0\" hspace=\"0\" onload=\"resizeIframe(this)\""
"frameborder=\"0\" vspace=\"0\" hspace=\"0\""
"style=\"overflow:visible; width:100%; display:block;\">"
"</iframe>";