user9011377
user9011377

Reputation:

Acknowledge whether user has a program bound to a certain protocol

I need to know if on their browser or OS, user has a navigation program associated with the protocol geo:

My link are like this: <a href="geo:51.5125509,-0.2190250">Address</a>

Previously, I was just checking if user was on mobile, and in this case, open the link. If on desktop, the link was changed to

https://www.openstreetmap.org/directions?to=51.5125509,-0.2190250.

However, user can have registered a default website or program on desktop for a given protocol, so I want to change my function.

I'v tried to test

navigator.registerProtocolHandler('geo', 'https://www.example.com/%s', 'Test Geo Handler');

but it necessarily triggers a permission modale and actually does not tell anything about what I need.

EDIT: I already checked these questions but in my case it's not a custom protocol so I thought I might have a chance.

Check if a browser supports a custom protocol using JavaScript?

How to check if a custom protocol supported

Upvotes: 4

Views: 147

Answers (0)

Related Questions