How to embed a “live” web page in WordPress blog posts

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:

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)

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 page, 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.

Want to learn more about web programming? Check out these popular books at Amazon:

Related

About Mu Lin

Dr. Mu Lin is a digital journalism professional and educator in New Jersey, United States. Dr. Lin manages an online marketing company. He also manages MulinBlog Online J-School (www.mulinblog.com/mooc), a free online journalism training program, which offers courses such as Audio Slideshow Storytelling; Introduction to Social Media Marketing; Writing for the Web; Google Mapping for Communicators; Introduction to Data Visualization; Introduction to Web Metrics and Google Analytics.

You are Master Thank you very much.
i used another HTML code for this
Page Builder than insert a new columb
a new text HTML
Copy and past this code
change only “http://www.Example.com” to “http://www.yoursite.com”

Hello,
I have used your code and it embeds the page fine, but for some reason I cannot change the size of the image. It is set to a small size and cannot be fixed. I have changed to width and height to no avail and have tried everything suggested here:

There seems to be some invalid codes in your page HTML: width=””800px″” height=””800px″”; take out the extra quotation marks; if it still does not work, try manually type up all the quote marks.
Besides, double check the string of codes in your html with the demo in my post; you’ll see it looks different than the format in my demo.

The code works for me but I would love to put in my enewsletter and have it link to my wordpress pages. When I use the code it puts the pages inside the small area, how do I have it open in the parent window?

Hi, I am trying this to embed a google drive folder with shared link inside my webpage. The code worked fine for cnn.com or some other sites I tried, but when I type the URL of the google drive share link (the share folder) it goes blank. Any ideas why ?

When I check the source codes for that page, I see instances such as:
width=””650″” height=””500″”
Note the double quotation marks there? They are invalid and being substituted by the browser with default dimensions.
So, in your editor, make sure you only have one set of quotation marks, and they should be the straight marks, not the curly marks.

Hello Mu Lin;
Thank you very much for your help. I did follow your advice and it did work.
The strange thing is that I copied and pasted your code and I have no idea where the double quotes came from….However I copied and pasted your code again, I have double checked it and this is what I see in the source: , but as you see still the CNN page is not showing accordingly. http://www.featherandthought.com/blueshorevancouver/search-test-mls/
Thanks again for your help.
HB

Is there a way to post just a specific area of the site? For Example, the content is far to the right to be seen without scrolling to the right. is there a way to trim the margin on the left to center the content?

This solution is just what I needed! Thank you. I am embedding an html site that I created, so I’ve been able to successfully adjust the content width to fit 100% of the body area within my WP page (which has a sidebar). Looks great.

One question: While the page is great with a full monitor, the html is cut off when viewed in an iPad. Would be great to have it scale appropriately (the Theme does). I have full control over the embedded html and the WP theme.

I appreciate you taking the time and energy to put this short article together.
I once again find myself personally spending a significant amount of time
both reading and commenting. But so what, it was still worth
it!

Mu Lin, thank you so much. I am a remedial massage therapist working inside a large clinic, and needed to link the clinic’s online booking system to my own website. This solution means users no longer have to leave my site and go to the clinic’s site in order to book my services — I just embedded the booking page into my site.

I’m really happy, this has been bugging me for ages. Thank you so much, it makes it much much easier for clients to book me!

Hi! Great tip!! I have a question about it though: is it legal?
Please don´t take my question as anything rude; what I´m trying to say is if by using this tool I am “stealing” traffic from the webpage I embed in my own site.

I would really much like to use it but do not want any kind of trouble with other website owners!

Like many tips out there on the web, the use of it at the discretion of individual users. That said, no, this embed will not bring any traffic to your site. Take this tutorial article as an example – it has been around for years, but my stats never show any referral traffic from the CNN site.

Hello,
Ive got a more specific question. Id like to embed a password protected website into a website. Ive got an account on a website and I would like to add this to my own website so that when other people create an account on my website, theyll get instant access to that website without me having to enter the password – it would already be there. Is there a code which allows that? Something like website name, website loging details and once its on visibe on a website, everyone has access to it.
Please help.
Thank you very much.

Mu, I tried your code to embed a link to real estate listing results and the results page with ten listings in a row embedded perfectly just as if you looked at the link results in a browser. It looks as natural as a web scraped page of listings I have on another website – like it was designed into the page with no i frame looking scroll bars.

However, if I click one of the listings to view its listing details, the page of listings turns blank white and no listing detail comes up? If I click the back arrow in my browser I get the embedded page of listings again?
What could be going on that prevents the listing detail view from pulling up?