admin管理员组文章数量:1318563
I have an external domain 'domainB' that I am pulling content from. Included in domainB's scripts is iframeResizer.contentWindow.min.js
My domain 'domainA' includes iframeResizer.min.js and I am calling it like:
$('iframe').iFrameResize({log:true, checkOrigin:false,
heightCalculationMethod:"taggedElement"});
No matter what I change the 'heightCalculationMethod' to, it doesn't have any affect on the iframe's height. Below is the logging
[iFrameSizer][Host page: iFrameResizer0] Added missing iframe ID: iFrameResizer0 (http://domainB/) iframeResizer.min.js:8
[iFrameSizer][Host page: iFrameResizer0] IFrame scrolling disabled for iFrameResizer0 iframeResizer.min.js:8
[iFrameSizer][Host page: iFrameResizer0] [init] Sending msg to iframe[iFrameResizer0] (iFrameResizer0:8:false:true:32:true:true:null:taggedElement:null:null:0:false:parent:scroll) targetOrigin: * iframeResizer.min.js:8
[iFrameSizer][Host page: iFrameResizer0] [iFrame.onload] Sending msg to iframe[iFrameResizer0] (iFrameResizer0:8:false:true:32:true:true:null:taggedElement:null:null:0:false:parent:scroll) targetOrigin: *
So it appears it is working, there are no errors, but it is having no effect. Is there a better way to do this, one that would actually change the height of the iframe?
I have an external domain 'domainB' that I am pulling content from. Included in domainB's scripts is iframeResizer.contentWindow.min.js
My domain 'domainA' includes iframeResizer.min.js and I am calling it like:
$('iframe').iFrameResize({log:true, checkOrigin:false,
heightCalculationMethod:"taggedElement"});
No matter what I change the 'heightCalculationMethod' to, it doesn't have any affect on the iframe's height. Below is the logging
[iFrameSizer][Host page: iFrameResizer0] Added missing iframe ID: iFrameResizer0 (http://domainB/) iframeResizer.min.js:8
[iFrameSizer][Host page: iFrameResizer0] IFrame scrolling disabled for iFrameResizer0 iframeResizer.min.js:8
[iFrameSizer][Host page: iFrameResizer0] [init] Sending msg to iframe[iFrameResizer0] (iFrameResizer0:8:false:true:32:true:true:null:taggedElement:null:null:0:false:parent:scroll) targetOrigin: * iframeResizer.min.js:8
[iFrameSizer][Host page: iFrameResizer0] [iFrame.onload] Sending msg to iframe[iFrameResizer0] (iFrameResizer0:8:false:true:32:true:true:null:taggedElement:null:null:0:false:parent:scroll) targetOrigin: *
So it appears it is working, there are no errors, but it is having no effect. Is there a better way to do this, one that would actually change the height of the iframe?
Share Improve this question edited Dec 19, 2016 at 15:56 Kevin Kloet 1,0861 gold badge11 silver badges21 bronze badges asked Dec 19, 2016 at 15:34 Dirty Bird DesignDirty Bird Design 5,55313 gold badges67 silver badges127 bronze badges3 Answers
Reset to default 5I had the same issue. In my case this was because in the page within the frame (the page with iframeResizer.contentWindow.min.js) there is an external plugin which sets this CSS style:
body,html{height:100%}
I fixed it by adding this CSS in the page within the frame:
body, html {height:inherit !important;}
I was having the exact same issue as you (same settings and all), and realized that I did not have iframeResizer.contentWindow.min.js
included correctly on my 'domaindB'
Once I made sure it was included, it worked - and a much longer list of logs was being printed.
Like you, I was under the assumption that because the initial short list of logs (that you quoted) were being printed, the two pages were municating; however, this is not true.
If you have sourceMaps enabled, you should see logs ing from iframeResizer.contentWindow.min.js
like this:
iframeResizer.contentWindow.js:150[iFrameSizer][iFrameResizer0] Initialising iFrame (http://domainB.site)
iframeResizer.contentWindow.js:150[iFrameSizer][iFrameResizer0] TargetOrigin for parent set to: *
iframeResizer.contentWindow.js:150[iFrameSizer][iFrameResizer0] height calculation method set to "taggedElement"
etc etc.
If that is all you are seeing in the log, then the script isn't being loaded into domain B, or some other JS code on domain B is crashing and stopping this JS from running.
本文标签: javascriptiFrameResizer not calculating height of iframeStack Overflow
版权声明:本文标题:javascript - iFrameResizer not calculating height of iframe - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742048180a2417916.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论