There are times you need to show a “live” web page in your post, not just a screenshot of that web page. With an embedded web page, readers can use the mouse to scroll up/down or left/right to explore the actual web page.
Here’s a simple solution. To do this, all you need to do is to tweak some simple codes:
<object data=http://www.example.com width=”650″ height=”500″> <embed src=http://www.example.com width=”650″ height=”500″> </embed></object>
How to tweak the code
- replace the two instances of “http://www.example.com” with the actual URL of the web page you want to embed
- change the width and height to meet the need of your post (650 px works best for the default post width of my blog)
- copy and paste the tweaked code into the Text editor of your post
Here’s the tweaked code to embed CNN home page (Remember, you need to paste the tweaked code in the Text editor, not the Visual editor, of the new post window):
<object data=http://www.cnn.com width=”650″ height=”500″> <embed src=http://www.cnn.com width=”650″ height=”500″> </embed></object>
How to add a border to the embed web page
You may want to add a border to the embedded web page so that it stands out better, then you need to tweak another simple code:
<div style=”border: thin #000000 solid; width:650px;”>embed code</div>
If you are familiar with CSS, then the code is self-explanatory to you. But if you don’t know what CSS is, don’t panic, you can literally copy and paste the code above to add a thin black border to any embedded web page – all you need to do is to replace “embed code” with the tweaked code you just created.
Here’s the complete code to embed the CNN homepage with a thin black border (Note again, you need to do this in the Text editor)
<div style=”border: thin #000000 solid; width:650px;”><object data=http://www.cnn.com width=”650″ height=”500″> <embed src=http://www.cnn.com width=”650″ height=”500″></embed></object></div>
Possible issues you may have
- This method works with self-hosted WordPress; I haven’t tested if it works with the free WordPress.com blog.
- The embedded web page cannot shrink to fit the (shorter) width of your blog post, so consider embedding a web page which has its major contents along the left side of the web, e.g., another blog post. That said, you can always scroll horizontally with any embedded web page though.
- If you don’t know what an Text editor is: when you create a new post, by default you are in the Visual editor window; but look at the upper right corner of the editing window – there is a Text tab next to the Visual tab, click the Text tab and you are in Text editor.
- This is important: once you are in Text editor, you should not switch back to the Visual editor; because if you do, the code you entered will be interpreted differently by the editor and will NOT display properly when you preview.
- Here’s one more thing: if you copied and edited the sample codes but things don’t work out, try retyping all the quotation marks directly in the Text editor.
- 5 tips for effective web writing: Anatomy of a functional blog post
- Basic web scraping and data visualization using Google Spreadsheets
- Embed video and photo in Google maps: A beginner’s guide
- Tutorial: Embed a Google Fusion tables map, with a legend, to a WordPress post
- Timeline tools for news reporting have rooms for improvements