mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-12-03 15:34:06 +00:00
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:
parent
15702d860b
commit
376f0f1c62
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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>";
|
||||
|
||||
|
|
Loading…
Reference in a new issue