I want to give a link of network local file in browser, where users can open from there.
link would be like this file.xls
In IE6,7,8 it doesn't work.
Any idea ?
You can use the File URI scheme.
http://en.wikipedia.org/wiki/File_URI_scheme
Related
I'm new to Vue.js and would like to know if there's a way to view PDF files that are stored independently from the Vue project through said Vue application.
Here's what I need:
All PDF files are stored in a folder. I'd like to provide links to access them in the application that I get from the backend server. Upon clicking the link, the PDF should open in a new tab and the URL would simply be something like
file:///C:/Users/user/Downloads/campusmap.pdf
What I have tried so far:
<a :href="fileAddress">View file</a>
When I hover over the link on my browser, It shows the right URL but clicking on it does nothing.
If I right-click to open in a new tab, it says blocked (about:blank#blocked)
Using <router-link> shows
localhost:8080/C:/Users/user/Downloads/campusmap.pdf
when hovered over it.
Is there a way to be able to just view the PDF through a link the way I want? Please note that I can't store all the PDF files in the asset or public folders.
Thanks for your help!
You can't link to a file:// protocol url from a page sourced via the http(s):// protocol - this is a security measure built in to modern browsers. Your only option is to also serve up the local files behind a web server, or run the app locally behind a file:// url.
In IE, it's quite easy to "Open in Excel" a url to a file on a network or internet location. Is the same possible in Chrome though? The file must be opened from its current location, not from a downloaded copy. So when the user saves any changes, they save to the original location. IE Tab isn't an option either, we cant install chrome extensions.
Things I've tried:
1) Web protocol: "ms-excel:ofe|u"
Open in Excel
2) ActiveX (I know it wouldnt work with Chrome, adding for completeness)
<input type=button onClick="test()" value="javascript solution">
<script type="text/javascript">
function test() {
var Excel = new ActiveXObject("Excel.Application");
Excel.Visible = true;
Excel.Workbooks.Open("//server/folder/Test.xls");
}
</script>
3) Direct link to the file:
Click<br />
This just downloads the file to the local machine and can be set to open as soon as it downloads, but changes are saved locally.
UPDATE:
I've found that trying to access a file stored in sharepoint works using method 1 above.
Open in Excel
Any reason it would work for sharepoint files but not files stored in a network location?
UPDATE:
I've found documentation for the ms-excel:ofe|u| web protocol which states that only http and https are supported.
*Bounty will only be awarded to answers to the specific question:
Is there any way to open a file in excel with chrome where the path to
the file is a local or network storage location rather than a
http/https url?
No it is not possible for security reasons. All newer browsers (and I guess even the newer implementations of IE), don't allow file access to the local system. Internet Explorer is the only browser that supports opening files from locations, that are seen and treated as local ones.
You can open files from a Webdav Server, which is probably, why you can access files from your SharePoint, so you could try mapping that provider of your network drive as a Webdav Server.
Source: https://www.codeproject.com/Questions/1180249/Open-edit-save-excel-sheet-from-browser-using-java AND
Is there an Application URL Protocol for MS Word?
You upload your excel on Google drive and people can use it from google sheets.
Browser functionality is to download the copy of file to local Computer.
You should use File server FTP server and other Protocols to actually edit file at source.
There are Web file manager software which can give you ability to save file. Try Cloud version of software etc to save file in web page and see the version history too. GitHub can have Private repository too.
Basically the chrome extension I'm making will download an mp3 file, edit the metadata, then download it on the user's machine.
I have the last part done by using chrome.downloads.download() (I'm pretty sure I can download a local path instead of a url).
But, I'm not sure how to download a file like this one into a directory local to the chrome extension (I don't want the user opening the file before it edits the metadata).
Nevermind, I found the answer: Broswer ID3 Writer by egoroof. This literally does everything I need. What an amazing library!
I'm trying to make it so that a file from my web server can be downloaded to an Android mobile device. I want the user to be able to press a Download button on the site, and then they will have the option to save it on there phone's sd card.
The only way I can think of doing this is by using FTP, and having the button navigate the user to ftp://username:pass#webserver/file.blah
Is there another way, using strictly HTML5 and JS?
I have tried using the download tag, but that doesn't seem to work. Instead of downloading the image it redirects them to the page with the image on it.
Link
HTML5 solution
To force downloading a file, if you are using HTML5, then you can use the download attribute by defining the anchor tag like this.
Download Link
Server-side solution
It is likely that the user's browser doesn't support the download attribute. Check this. So the other solution invloves the server-side. You can use the Content-Disposition HTTP header. Serve this as one of the headers of the HTTP response for the download route. This will force the browser to download the file as an attachment.
Content-Disposition: attachment; filename="download.png"
RFC Read section 19.5.1
I have WAMP installed on a network machine. I have a table with file links, for people could open those files directly from a web page.
Those files are in another server, in the same network as WAMP.
When the users click on the link it appears the following error:
"not allowed to load local resource: file:///networkdrive/directorie/file.xls"
How can I resolve this?
I have this:
<button type="button" onClick="openfile('networkdrive/ptlr/Sectorial/LRCD/HorĂ¡rios/Equipas Turno.xls')">botao</button>
<script>
function openfile(file) {
window.location = "file:///" + file;
}
</script>
Just read the error: "not allowed to load local resource (...)"
Or on Firefox I get "Access to (...) from script denied".
It seems you are looking for a magical solution that will solve it, but no, it's exactly as the description of the error says: you are not allowed to do that because of security reasons.
The problem is that you're trying to make the browser open a file on your local drive, and that's not allowed from any protocol other than file:/// itself. So, what you'll want to do is either make sure the local file is also accessible via a server, or open the webpages that contain this script from file:/// too.
You can see this at work by first opening http://jsbin.com/OYObEMA/1/ and seeing this same error occur, then pressing CTRL+S and saving it as a single HTML file, and opening that HTML file then. The JSBin one opens via the internet, so isn't given access to the file:/// protocol, but the local (downloaded) HTML file can access it.
One way you could kind-of do this is to just provide the url the user needs to go to instead. So, just make an <input> that has a value set to the url the user would need to go to, and then provide the instructions "please copy this url into your url bar to open this file". That's not an elegant way to do it, but it would kind-of work.
About your answer to my initial comment: sure, I understood that. The question was not meant in a literal way, but to make you start thinking about what you actually try! You mix different environments.
either need to use webdav for this, if your client side applications are able to use that http extension to load and save files, or
you have to do the old scheme known from the IT middleages which is still typical for MS-Windows systems: offer the file for download via http and add an additional upload service (which will give you versioning pain), or
deliver your web page via the same protocol (network share) so that it is opened with as a local file on the client side, since then your are allowed to open additional local files referenced inside the web page.