Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom protocol handlers Linux, Centos 7 for chrome

I have developed an application which is invoked on a button click on my website. I was using NPAPI for this task. However recently google has deprecated NPAPI so I called my application using custom protocol handler like "myapp://"

On windows my application and handlers are working perfectly fine.

Now I want to do the same in Linux. I need to do this for CentOS preferably 7 and for Chrome web browser.

I did some research but most of the help on web is for firefox but I specifically need it for chrome. My desktop is GNOME based, kindly help please.

like image 763
Fahad Malik Avatar asked Aug 18 '15 05:08

Fahad Malik


People also ask

Where is the protocol handler in Chrome?

If you are using a PC, your windows settings will pop up. 18. In Google Settings>Site Settings>Protocol Handlers, choose Google Chrome as your default email app.

How do I change the protocol settings in Chrome?

To Change Protocols Handlers in Chrome Browser: If you wish to change one protocol handler to another, then visit chrome://settings/handlers and choose the protocol handlers from the drop-down menu and click Done button.

Where is Gmail service handler?

The “Content Settings” menu is going to give you numerous complex options, so be careful what you click. In this more advanced menu, look down at the bottom section where you see “Handlers.” Select the “Manage Handlers” button there so you can add information about Gmail.


1 Answers

To add protocol handler myapp:// you need to add file myapp.desktop to ~/.local/share/applications. It looks like this:

[Desktop Entry]
Name=myapp
Exec=/path/to/your/program %u
Type=Application
Terminal=false
MimeType=x-scheme-handler/myapp;

Exec and MimeType are very important.

Then you need to add line

x-scheme-handler/myapp=myapp.desktop

to file ~/.local/share/applications/mimeapps.list under [Default Applications]

At the end you will probably need to type command:

update-desktop-database ~/.local/share/applications

For me it was working on all browsers.

like image 98
Paweł K Avatar answered Oct 19 '22 02:10

Paweł K