Eon*_*Eon 15 html asp.net iframe
我目前正在开发一个必须通过使用iframe从其他网站下载内容的网站.有什么办法可以裁剪下载页面的内容,只显示我网站上该页面的一部分吗?
Pek*_*ica 32
有什么办法可以裁剪下载页面的内容,只显示我网站上该页面的一部分吗?
否.同源策略阻止您iframe以任何方式操纵,包括滚动位置.
将iframe一个div容器放入一个具有已定义高度和宽度的容器,并overflow: hidden剪切视口,可以解决这个问题:
<div style="width: 500px; height: 500px; overflow: hidden">
Run Code Online (Sandbox Code Playgroud)
并给出iframe相对位置:
<iframe src="..." style="position: relative; left: -100px; top: -100px">
Run Code Online (Sandbox Code Playgroud)
这样,您可以调整页面上可见的iframe部分.但是,整个页面仍然会被渲染,这种方法不能免受像iframe内部滚动这样的影响.
小智 6
<div style="position: absolute; left: 0px; top: 0px; border: solid 2px #555; width:594px; height:332px;">
<div style="overflow: hidden; margin-top: -100px; margin-left: -25px;">
</div>
<iframe src="http://www.centricle.com/tools/html-entities/" scrolling="no" style="height: 490px; border: 0px none; width: 619px; margin-top: -60px; margin-left: -24px; ">
</iframe>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这段代码对我有用.
来源[ http://extechbuzz.blogspot.com/2012/12/iframe-how-to-display-specific-part-of.html ]
为了裁剪嵌入页面底部的广告,我使用了以下方法:
<div style="width: 1000px; height: 390px; overflow: hidden">
<iframe src="https://openflights.org/user/dankohn1" width="1000"
height="600" style="border:none" scrolling="no">
</iframe></div>
Run Code Online (Sandbox Code Playgroud)