simplest cross-browser check if protocol handler is registered

后端 未结 5 1416
青春惊慌失措
青春惊慌失措 2020-12-02 14:47

When user clicks link with custom protocol (like myapp://superlink)

I need either launch an app or allow user to download and run configuration app

5条回答
  •  庸人自扰
    2020-12-02 14:55

    I had a similar problem where I needed to check whether a custom protocol is already registered (which will open an executable file), or otherwise open a download page or do something else. Unfortunately there is no easy way to deal with this since every browser behaves differently. I tried to collect all information and come up with a rather generic library for this matter, you can take a look at:

    https://github.com/ismailhabib/custom-protocol-detection

    ps: the solution for non Windows 8 IE is rather ugly, but I couldn't find a better solution.

提交回复
热议问题