embed word file into iFrame

I'm trying to embed a word document in an iFrame. Not to edit only view, so I thought you could just put in the src parameter, but it just opens up in word itstead.

<!doctype html>

<html lang="en">
  <meta charset="utf-8">

  <title>Word iFrame Test</title>

  Below is a preview of a word file:-
  <iframe src="War and Peace.docx" height="300px" width="300px">


Open in new window

Can anyone advise the correct way of embedding a word document inside an iFrame? Even a PDF file..
Who is Participating?
The best practice for this sort of thing is to save the word doc as HTML and use that to go to the page.  Otherwise you are going to spend a lot of time spinning your wheels.

Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
i believe this is controlled by the browser settings. You'll need to either convert it to html or use a 3rd party control to view it
tonelm54Author Commented:
After a bit of reading Ive found you need to use an object then embed:-
		<object src="WarPeace.docx">
			<embed src="WarPeace.docx" type="application/vnd.openxmlformats-officedocument.wordprocessingml.document" />

Open in new window

tonelm54Author Commented:
However putting it as an object doesnt seem to work:-
<object src="WarPeace.docx">
	<embed src="WarPeace.docx" />

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.