Jump to content

Links to documents


Glom
 Share

Recommended Posts

In the interests of my productivity, I want to compile a list of links to documents important to me that are strewn all across our unnavigable server. My favourite idea is a simple HTML page with direct links to these documents. The only problem is that they open inside the browser. Is there some simple markup that will open them up outisde eg a spreadsheet opens up in Excel etc?(yes I know I could make a folder of shortcuts and that's plan B if this doesn't pan out)

Link to comment
Share on other sites

If the files are not web pages, they should be automatically opened up in the corresponding application.So

<a href="document.doc">document.doc</a>

will open up the doc file in MS Word.If that's not the case with you (and you see, say a plain text instead), you'll need to contact your host, asking him to "register the MIME types of MS Office files".If you mean to open up a directory outside the browser (i.e. in Windows Explorer), you'll need to add those files to an FTP server with read-only permissions for anonymous users.

Link to comment
Share on other sites

Guest FirefoxRocks

But are you sure that will work in Opera? Because if I'm not mistaken, I think that Opera will try to open the file anyways, regardless if you have Microsoft Office/OpenOffice.org or any program that will open .doc/.docx/.docm/.xls/.xlsx files.

Link to comment
Share on other sites

But are you sure that will work in Opera? Because if I'm not mistaken, I think that Opera will try to open the file anyways, regardless if you have Microsoft Office/OpenOffice.org or any program that will open .doc/.docx/.docm/.xls/.xlsx files.
That's only a half truth. Opera, like Firefox and IE, allows anyone to configure what files the browser downloads, which ones they open natively, and which ones they hand off to other programs. This is mostly user defined, so there is no true promise that it will download, open or whatever. Even on an FTP server, the same applies, at least I know so much for Firefox.You can change the settings in Firefox by going to Tools -> Options -> Click the Advanced Tab and select the Manage button. In Opera, you go to Tools -> Preferences ->Select the Advanced Tab, and select downloads.
Link to comment
Share on other sites

If your browser receives a file with a content-type that it has a registered handler for, regardless of the browser or the handler, then it will open the file with that handler. If a browser has a plugin for Microsoft Word installed that is set up to open Word files in the browser, then when the browser gets a file with a content type of application/ms-word it will use the plugin to display the file. If there is not a plugin set up in the browser, then it will give the save/open download dialog box, it gives that box for any content-type that it doesn't understand. If you always want the browser to give you the dialog box regardless of whether or not there is a handler associated with the content type, then you will need to set up an intermediary page to change the content type of the file. Or, you can also set up on the server that a .doc or .xls or whatever file should use the content type application/octet-stream. That will always force a download. If the server sends a content type of application/ms-word or application/ms-excel then the browser will attempt to use the plugin if it is installed.You can use a script like this to change the content header:

<?php$file = $_GET['file'];header("Content-Type: application/octet-stream");echo file_get_contents($file);?>

You can link to the script like this:<a href="download.php?file=c:\dir1\dir2\dir3\file.ext">file.ext</a><a href="download.php?file=http://server/share/file.ext">file.ext</a>The file variable in the URL should be a path that the download.php script can access, or you can also just send the script the filename and have the script attach the rest of the path.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...