如何裁剪iframe的内容以显示页面的一部分?

| 我目前在一个网站上工作,该网站必须通过使用iframe从另一个网站下载内容。有什么办法可以裁剪下载页面的内容,使其仅在我的网站上显示该页面的一部分?     
已邀请:
  有什么办法可以裁剪下载页面的内容,使其仅在我的网站上显示该页面的一部分? 不能。“同源起源”策略阻止您以任何方式(包括滚动位置)操纵ѭ0。 可以通过将ѭ0放入具有定义的高度和宽度的
div
容器中,并使用ѭ3clip来固定视口的解决方法:
<div style=\"width: 500px; height: 500px; overflow: hidden\">
并给ѭ0一个相对位置:
<iframe src=\"...\" style=\"position: relative; left: -100px; top: -100px\">
这样,您可以调整iframe在页面上可见的部分。但是,整个页面仍会呈现,并且这种方法无法避免在iframe中滚动等影响。     
<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>
这段代码对我有用。 来源[http://extechbuzz.blogspot.com/2012/12/iframe-how-to-display-specific-part-of.html]     
在iframe中,您无法执行此操作...但是,如果您使用HTTPWebRequest / WebResponse,则它非常简单... http://www.codeproject.com/KB/IP/httpwebrequest_response.aspx http://htmlagilitypack.codeplex.com/ 这个包非常重要...您可以通过id阅读特定的div / span ...     
为了裁剪嵌入页面底部的广告,我使用了以下方法:
<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>
    
这段代码对我有用。...将边距顶部和左边距调整为最适合您的值,并将iframe的高度和宽度调整为所需的值。
<html>
<div style=\"overflow: hidden; margin-top: -1440px; margin-left:0;\">
<iframe src=\"https://fiitjeelogin.com/StartPage.aspx\" scrolling=\"no\" height=\"1550\"width=\"300\" frameBorder=\"0\">
</iframe>
</div>
</html>
    

要回复问题请先登录注册