I want to start this post by saying that I’m not a fan of using iframes, however, sometimes due to restrictions within some development environments it may be the only way to embed content into your site of blog.
// Set path to the iframe file var filePath = 'http://www.myspace.com'; // Setup the iframe target var iframe='<iframe id="frame" name="widget" src ="#" width="100%" height="1" marginheight="0" marginwidth="0" frameborder="no" scrolling="no"></iframe>'; // Write the iframe to the page document.write(iframe); var myIframe = parent.document.getElementById("frame"); // Setup the width and height myIframe.height = 350; myIframe.width = 960; myIframe.src = filePath; // set the style of the iframe myIframe.style.border = "1px solid #999"; myIframe.style.padding = "8px";
And that’s it, any questions or comments leave them below.
Designer and web developer, Co-founder and Technical Director at Harkable.com London. Previously I worked at InMobi, Spotify and MySpace. Interests include photography and making short videos. Also an avid F1 fan. I also run Mega Infographics for your daily dose of the best infographics.
Follow us on Twitter and get in-stream updates.
Subscribe to all the Papermashup tutorials and articles straight to your RSS reader.
Sign up and get all the Papermashup tutorials straight to your inbox.