SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard
    Join Date
    May 2012
    1 Post(s)
    0 Thread(s)

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

  2. #2
    SitePoint Zealot 2ndmouse's Avatar
    Join Date
    Jan 2007
    West London
    0 Post(s)
    0 Thread(s)
    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 Code:
    <title>Open Word in Iframe</title>
    <DIV align="CENTER">
    <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>
    <iframe name="awindow" frameborder=2 width=580 height=440 src="title.html"></iframe>
    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.
    Detect file changes remotely. SimpleSiteAudit is an early
    warning anti-hacker system which sends an alert on detection.

    PHP Find Orphan Files - Finds all the unreferenced files on your site.

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Sydney, NSW, Australia
    25 Post(s)
    1 Thread(s)
    Quote Originally Posted by 2ndmouse View Post
    I don't usually recommend iframes and this isn't really a PHP question, but here's a possible DHTML solution:
    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.
    Stephen J Chapman, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Madison, WI
    34 Post(s)
    2 Thread(s)
    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.

  5. #5
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    51 Post(s)
    2 Thread(s)
    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...)).


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts