Auto Open Command Dialog Box in Chrome

FileRun has a beautiful File-Explorer Google Drive. You can testdrive it here FileRunDemoSite

When I download a file, I can choose if I want to open the file directly in an Office application.

Open dialogue

When I click on Office, google prompts me to open Chrome's open file dialog. The file opens directly from the location, not in the / downloads / folder.

enter image description here

How can I achieve this behavior? All of the existing answers to SA state that this is not possible, so it might be of interest to others as well. Even Google hasn't followed through on this. Is there a cross-browser solution?

Onedrive does this also:

enter image description here

+3


source to share


2 answers


Thank Thomas2D for helping me on the right track. Principle of operation:

If you are developing an application, you can register a new protocol with the operating system. http://

will be handled by your default browser. applicationX://

will be processed by applicationX, ms-word://

will be processed by word. If you click on the link, the browser / operating system is looking for which application should handle the protocol, pass the request to that application.

For Office documents, the URI is slightly more complex than ms- excel:ofv|u|http://contoso/Q4/budget.xls

. You can open it read-only / edit / as a template. Check out this document for a detailed description of all options: Office URI Schemes

For other apps, check URI schemes with this app.

How to use it on the website:



It is not recommended to link to the application in the href attribute of the Dom element. There is no way for you to check if the app is installed or not.

If you are using Javascript you can check if the request expires / does not execute and use instead http://

.

... Set the protocol to, href: window.location.href = encodeURI('ms-excel:ofe|u|http://example.com/excel.xlsx')

or by setting location.protocol

, https://www.w3schools.com/jsref/prop_loc_protocol.asp

There is a jQuery plugin for that: jquery.applink.js

+1


source


I personally believe this is achieved by launching the application through a specific URL.

I know this works on iOS to run the app. On iOS this was done by something (simillar before mailto:example@example.com

)

<script type="text/javascript" charset="utf-8"> 
window.location = "myapplication://myparams";
</script>

      



EDIT: I finally figured out you need to use the app url scheme. For example, if you want to open an Excel file through a browser, you must use this JS code.

window.location.href = encodeURI('ms-excel:ofe|u|http://example.com/excel.xlsx');

      

0


source







All Articles