I am currently working on a website which must download content from another website through the use of an iframe. Is there any way that I can crop the contents of the downloaded page to only show a section of that page on my website?
相关问题
- Views base64 encoded blob in HTML with PHP
- Carriage Return (ASCII chr 13) is missing from tex
- How to store image outside of the website's ro
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
This code worked for me.
Source [ http://extechbuzz.blogspot.com/2012/12/iframe-how-to-display-specific-part-of.html ]
In iframe you cant do it...but if you use HTTPWebRequest/WebResponse then its very simple...
http://www.codeproject.com/KB/IP/httpwebrequest_response.aspx
http://htmlagilitypack.codeplex.com/
This pack is very important...you can read specific div /span by id ...
No. The Same Origin Policy prevents you from manipulating the
iframe
in any way, including the scroll position.There would be a workaround by putting the
iframe
into an adiv
container that has a defined height and width, andoverflow: hidden
to clip the view port:and giving the
iframe
a relative position:this way, you can adjust the portion of the iframe that is visible on the page. However, the whole page still gets rendered, and this approach is not immune to influences like scrolling inside the iframe.
This code worked for me... Adjust the margin-top and margin-left to whatever value suits you best and adjust height and width of iframe to whatever value you want.
To crop off the ads at the bottom of the embedded page, I used the following: