Launch Applications From The Browser?

-1

Good morning, I have the following question several days ago I am trying to open applications that have installed the client from the browser, As seen in the attached images (This is from Google Chrome) (This functionality is from BitBucket) where it opens SourceTree Always with a confirmation from the client if you want to do it or not.

I have read about how to do it and what I saw are always negative answers (You can not) and others have proposed solutions with ActiveX or applets of which the ActiveX apparently only supported by Internet Explorer and / or other browsers with a plugin "Simulating" being in Internet Explorer which does not seem an inappropriate solution and the applets apparently they stopped being supported in the navigators as of 2015 for reasons of security

Some recommendations on how to achieve this functionality because I can not limit to my users to IE only, any idea is well received !, Thank you very much ] 1

    
asked by Davis 28.12.2017 в 20:23
source

1 answer

0

Short answer:

You can not

Alternatives

The URI'S can be exploited, thanks to the specifications of URI and HTML , a links allow URI's and not only URL's in turn the URI specification allows an infinite number of protocols (called schemas)

Modern browsers if they detect a protocol that they do not understand they look for in the operating system if there is a program that does, if it exists, then it executes it and sends the complete URI to the program as a parameter.

A program accessible from the web MUST :

  • Register your schema in the target operating system
  • Place links to your program through the a tag
  • TL; TR

    In the case of windows it is possible to register a new scheme and assign a specific program from the Windows Registry

    For example to create the uri scheme cmd accessible from the browser through cmd:foo where foo is the program to execute the following entries must be added to the registry:

    cmd.reg

    [HKEY_CLASSES_ROT\cmd]
    "URL Protocol"=""
    
    [HKEY_CLASSES_ROT\cmd\shell]
    
    [HKEY_CLASSES_ROT\cmd\shell\open]
    
    [HKEY_CLASSES_ROT\cmd\shell\open\command]
    @="cmd /k \"echo %1\""
    

    Installing cmd.reg

  • Right click
  • Merge
  • Accept any alert
  • Trying it

    <a href="cmd:echo hola mundo">Abrir consola</a>

    Note:
    While cmd can be accessed from cmd:comando it is not that the command is actually executed. To actually execute the command you first need to decode the url that is received since you will receive a url encoded with the% notation % as%% of% the browser will send to our controller cmd:echo hola mundo

    More information on how to register schemas in the target operating system

    answered by 28.12.2017 в 22:39