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">
<head>
  <meta charset="utf-8">

  <title>Word iFrame Test</title>
</head>

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

</body>
</html>

Open in new window


Can anyone advise the correct way of embedding a word document inside an iFrame? Even a PDF file..
tonelm54Asked:
Who is Participating?
 
COBOLdinosaurCommented:
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.

Cd&
0
 
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
0
 
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" />
		</object>	

Open in new window

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

Open in new window

0
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.