JavaScript - Detecting Scrollbars in a Cross-Domain Iframe?

喜欢而已 提交于 2020-01-03 16:53:17

问题


I'm loading a cross-domain page (that I have no control over) into an iframe.

I want to know if this results in a scrollbar appearing in the iframe on my page or not.

I'm getting the impression that this just cannot be done (in Firefox at least), through any kind of direct detection or clever deduction, due to cross-domain security policies.

Please only answer this question if you have direct experience successfully doing this yourself -- or trying everything and giving up.

(Those other discussions you want to refer me to don't work for cross-domain iframes with no control over the embedded page. And if you think jQuery must have something for this, please test it out first yourself to make sure.)

TIA -- I don't have an SO account to respond to your answers. (do now)


回答1:


It is not possible to do this because of the browser's security model. If it was possible, that would be a security problem and would have to be fixed. See my complete answer to this similar question for a more complete explanation.



来源:https://stackoverflow.com/questions/4718688/javascript-detecting-scrollbars-in-a-cross-domain-iframe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!