Glom Posted September 25, 2007 Share Posted September 25, 2007 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 More sharing options...
boen_robot Posted September 25, 2007 Share Posted September 25, 2007 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 More sharing options...
Guest FirefoxRocks Posted September 25, 2007 Share Posted September 25, 2007 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 More sharing options...
Shonumi Posted September 25, 2007 Share Posted September 25, 2007 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 More sharing options...
justsomeguy Posted September 25, 2007 Share Posted September 25, 2007 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.