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.
Related
I'm writing a chrome extension which will add custom images to a webpage. I want the users to put all their images in the "backgrounds" folder, and I want my extension to be able to retrieve the file names of every file in the "backgrounds" directory in the extensions folder. It seems like there is no way to do this in chrome extensions. When I try to use the chrome fileSystem API, I get this error:
There were warnings when trying to install this extension:
'fileSystem' is only allowed for packaged apps, but this is a extension.
How can I do this?
You can get read-only access to your extension's folder with chrome.runtime.getPackageDirectoryEntry, with which you can work using the HTML5 FileSystem API.
However, this will not allow you to do what you want to do.
While you're developing an extension, it will work fine, as Chrome does not mind changes to the extension's folder - they are expected.
However, when the extension is deployed to users, Chrome will maintain a cryptographic hash of the extension folder's contents. In case there are any external modification to the files, the extension is considered compromised and is forcibly disabled.
So you should consider other approaches instead, such as:
using the above HTML5 FileSystem API to have a virtual persistent filesystem to which you can let the user "upload" files through your UI;
storing data as blob:/data: URIs in chrome.storage or IndexedDB;
asking the user to put the files in a cloud drive your extension can access using its usual API.
I have been looking for some solutions for this, i got one here - Show PDF file in Android WebView using mozilla pdf.js Android API Level below 19
but then here he tries to open a local file, is there a way I can open files placed on my server.
You must enable CORS on your server http://enable-cors.org/server.html After that pdf.js could open file from your server as well as local file. Another way is to download file from server and open it locally.
Is there a function in the Chrome API that gets the most recently downloaded file?
My goal is to grab this file, copy it, and save it to a different location since in Chrome you cannot change the default download directory for specific file types/websites:
How to set download location via chrome api
Is this idea feasible?
The chrome.downloads API just became stable with Chrome 31. It allows you to deal with all download interactions, like getting the filename and the MIME type. I'm not sure if and how you can copy and move files on the user's system by a Chrome extension.
For your goal you could use the onDeterminingFilename function and alter the filename to contain subdirectories, like putting all .jpg files into Downloads/images/.
I am using HTML. I have placed an XLSX file in my file system and gave a link in HTML file through anchor tag as below.
<a class="someClass" href="SampleFile.xlsx" target="_blank" type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">DownloadFile</a>
But the problem is it does not work in IE. in IE xlsx file is downloaded as Zip file than xlsx file. But in firefox it works as intended.
in IE:
in FF:
How can i tell IE to download the file as xlsx file rather than zip file?
Thanks!
You will need to set the correct "content type" and/or "content disposition" headers on the server.
You can't do this reliably for Internet Explorer in HTML alone, but you you can do it server side (e.g. with PHP, ASP, or whatever it supports) or by configuring the web server the file is hosted on (e.g. Apache or IIS) to return the appropriate headers for all files with the given extension.
See this answer for some insight:
Setting mime type for excel document
Note: Because Internet Explorer exposes settings that override this behaviour, and different versions of Internet Explorer and Microsoft Office respond differently to some headers by default, you might find it always behaves a bit unreliably, even when you set the headings on the server. I've encountered different browser behaviour on corporate PC's at the same organisation with the same operating system and the same version of Internet Explorer and Microsoft Office, but was unable to find the root cause of the different behaviour (e.g. downloading vs. opening actually inside the browser vs. opening in the application) Other other browsers at least seem to behave consistently.
For a website I am working on, I need to allow users to be able to specify the path to a file on a network drive, so I simply tried using a file field and having javascript get the value, however because of browser security I cannot get this path.
Is there anyway to get around this browser security and allow users to browse to the file on the network drive and select it to specify the path?
Thanks,
Alex.
AFAIK this is impossible with javascript. Flash also forbids from accessing the client file paths. ActiveX could be used but it will work only in IE and must be installed on the client computer.