I would like to create a link on a web page, which points to a local file. Click it to start a local application to open it. Is it possible? If not, can a plugin of browser or any other approach achieve it?
URL Scheme can help you.
We are able to open a local application by a url like 'openmyapp://****',but you need to create a registry for your application.
ON the Windows System,the content of the registry is like this
[HKEY_CLASSES_ROOT/Alitalk]
"URL Protocol"="openmyapp"
[HKEY_CLASSES_ROOT/Alitalk/Shell]
[HKEY_CLASSES_ROOT/Alitalk/Shell/Open]
[HKEY_CLASSES_ROOT/Alitalk/Shell/Open/Command]
#="/"C://Program Files//Alisoft//WangWang//WangWang.EXE/" %1"
Related
In a web application I am working on I would like to be able to download files, modify them localy and reupload them to the server.
To make it as easy as possible for the users, I would like them to choose the download location and use a single button to upload the changes afterwards.
My current apporach is the following:
Use window.showSaveFilePicker to choose location and get a FileSystemFileHandle
Download the content and write it to the FileSystemFileHandle
Show a button which allows to upload the changes using FileSystemFileHandle#getFile to get the modified content.
This approach works pretty well but the user has to manually search and open the file after the download and I would like to support them in this step and make it as simple as possible.
Ideally the file should automatically be opened with the default application after the download but I couldn't find a way to do that.
One idea was to open the file in a new tab using the file://-URL, allowing the browser to decide what to do but the FileSystemFileHandle does not seem to expose the absoulte path.
Is there any way to open the downloaded file with the default application? If not, what other possibilities are there to make the mentioned use case as simple as possible?
Thanks in advance
EDIT:
I found that you can open certain applications using special urls like ms-excel:ofe|u|file://path/to/file.xls.
This would be enough for most use cases but for this to work I would need to get the file url from a FileSystemFileHandle.
For security reasons, there is no way for a Web app to open local apps. In the future, though, once file change events are implemented, you can await changes to the file, and then re-open it. This should solve your use case.
I have a windows form application which opens up from a web browser using uri protocol scheme.
I want to check if this windows form application is first installed on the user machine. Is there any way using javascript or jquery to check if the specific application is installed on the user machine first, and based on the installation show either the launch button or a download button.
I know that reading application exe from browser is not good from security standpoint, but if I am able to get this, I can show appropriate message to the user.
So any ways to find out using client side code, or reading specific registry based on my msi package application id saved in registry from client side or is it even recommended to have such a code in place?
Any advice or suggestions would be great.
Thanks in advance!
Checking exe file path can help.
If System.IO.File.Exists("C:\Program Files\notepad.exe") = True then
Msgbox "exe exist"
end if
Make your win forms application write some registry entries upon installation, something like the exe file location. then check for the those entries and decide to start the download URI or the launch URL browser.
I have a ASP.MVC app running in my company's domain. I would like to make links to Word, Excel or even to folders. For example I would like to allow user to access a project folder on public drive or Office document. Files and web app are on different servers, but in same domain.
The problem is that all modern browsers block access to local files. (Chrome throws an error saying "Not allowed to load local resource: file://..."). IE we are currently still using does allow that, but I can't rely on this.
How to tell the browser that it is safe to open those links?
I read about an option to serve .url files to user with link to file/folder. The downside is that I'd fill users temp folders with .url files. And also while I was testing this, I couldn't make changes to .url file after I saved it. Even removing the file doesn't help. It looks like windows stores it somewhere.
Another option was to make an a-tag with href like "data:text/plain;charset=utf-8..." and offer user to download .url file that way. But it was somehow not working for me.
Please help.
Thank you.
Please hear me out before you start crying security issues.
This is for an intranet application, hence I have full range to install any plugins or change any security permissions to suit.
What I want is for them to go to a webpage and click a link to download a file, such as a Word Document. This gets transferred to local storage of some kind (sandboxed if need be) and then is opened in word as a regular file.
When they click save, JavaScript or something will pickup the file is saved or the program is no longer accessing it and can be actioned upon, such as uploading back up to the server.
Is there any way to do this. I have looked at IndexedDb, WebStorage, HTML5 FileSystem API but I am new to all and don't see a way to do this.
I am open to coding any needed plugins as long as you don't mention Flash. The main issue I am coming across is opening a file downloaded into some form of local browser and then opening it via a desktop application, e.g. Word.
Any help, greatly appreciated.
After much research the only way to do it is with a plugin. IndexedDB, FileSystem API or WebStorage can not access the local file system. Which is good.
Silverlight is a good option for intranet and .NET, which is what I have chosen to go with.
Silverlight 5 in full permissions with a file watcher. The file watcher can be accomplished with this method: Is there an alternative to accomplishing what the FileSystemWatcher does in Silverlight?
I need full path to file when file is opened. For example user open file.txt but it will be opened with notepad or other. But how to register "hook" from NPAPI plugin to get path to file and prevent opening in other program?
An NPAPI plugin doesn't sound like it's at all the right technology for what you want to do. Plugins are for running native in the context of a specific web page, whereas it sounds like you just want a local application that's registered with the OS as the handler of certain file types.