Is it possible to see this in browser?

Hi, I am making a simple upload that will upload a word document…I am just working from my localhost.,…my question is,Is it possible to view the word document in browser,just like in the google…I want to make a button “view document”.and then if the user will click it,it will open the word document.Is this possible?

Thank you in advance.

I don’t usually recommend iframes and this isn’t really a PHP question, but here’s a possible DHTML solution:

Place an Iframe inside the page, the place a tartget link to the Iframe, like the below example.


<html>
<head>
<title>Open Word in Iframe</title>
</head>
<body>
<DIV align="CENTER">
<TABLE BORDER="1" CELLSPACING="1" CELLPADDING="1" WIDTH="100%">
<TR>
<TD WIDTH="25%" ALIGN="left" VALIGN="TOP">
<a href="doc1.doc" target="awindow">Doc 1</A><br>
<a href="doc2.doc" target="awindow">Doc 2</A><br>
<a href="doc3.doc" target="awindow">Doc 3</A>
</TD>
<TD WIDTH="75%" ALIGN="CENTER" VALIGN="TOP">
<iframe name="awindow" frameborder=2 width=580 height=440 src="title.html"></iframe>
</TD></TR></TABLE></CENTER>
</DIV>
</body>
</html>

Replace the doc names with the word document names.
Replace title.html with the file you want to originally show up in the iframe when the page loads.

Why have you provided an HTML 3.2 solution. That version of HTML was replaced by HTML 4 back in 1997 - about 15 years ago.

The issue currently is actually browser preferences. Even with the solution suggested above, FF, for example, will treat those links as files as ask you to DL ( or open them in WORD). Browsers will only display txt and html files everything else is sent to a helper app.

Well, browsers differ on what they’ll show as far as filetype. I was completely surprised when doing some user testing on a site where we had links to PDFs open “forward” (no target-blank). Since we did the testing on the browsers and OSes the users were using, they kept accidentally closing their browsers… because the PDF was opened in their browser, and they had expected a new window because that’s the behaviour they always see/get at all other sites they visit. This was why I ended up changing PDF links to new tabs/windows.

The reasons I and the other devs had not noticed this was because our browsers and OSes downloaded PDFs like files, leaving the browser pages unchanged.

Sometimes this is a setting you can change in your Accept-Headers and configure on the server end, but if the browser still doesn’t know what to do with a filetype, it should offer a download. I’m not sure what Google does, but I believe (since it’s so heavily javascripted) that they copy the information of the document and layer a web interface on top, so when you make changes it gets saved to the actual document too… but since I can’t see any documents without the pile of JS, I don’t think what we actually see and interact with in places like GoogleDocs are the actual files themselves.

If someone knows how that all works, please post! I’d be interested in knowing (also partially because all teh Google stuff seems horribly inaccessible to screen readers unless you’re using ChromeVox (gee, wonder why…)).