The Iframe Slide
With my back against the wall I will occasionally pull out the HTML iframe element and use it in a less than desirable way. For instance, say you need to acquire a section (not the entire page) of content on another domain. Like for instance, the Yahoo.com search box located at the top of the yahoo homepage.
With a bit of CSS trickery, it’s actually possible to isolate a specific region of the page that is being loading into the iframe. In a nut shell, you can place the iframe (positioned absolute) in a div element (position relative) and by using the div as a view box slide the iframe around to perfectly fit the view port. Did that make sense? Essentially the iframe can be given a negative left and top position in order to fix a particular x and y coordinate on the iframed page. Once you have position this coordinate, you then size the outer div to crop the view port down to the exact size of the content you are trying to extract from the iframed site.
Maybe an example would help explain. Check out the yahoo search box on my domain, using an iframe to isolate just the section of the yahoo homepage I want (the search box).
If the mouse pointer changes to a hand when you roll-over an image associated with a story the image upon clicking either links to enlarged version of the image or a website associated with the image.
You dirty content leecher. Nice writeup and sweet implementation. Now I shall claim all of CNN as my own! Mua Ha ha!
@Nate – With knowledge comes great responsibility.
I can’t wait to pull this article into my site and claim it as my own using this technique. Thanks!
Seriously, though – this is cool and you’re smart.
@Nate – Let’s no go overboard.