1

I have implemented a basic Python program that handles HTTP/HTTPS protocol links using the registry details here, and set it as my default browser.

This functions; when clicking a link in an application (other than my browser), my application is called with the link as an argument.

However, I'd also like to know what application the link that was clicked came from (eg: clicking a link from Discord, vs from Steam, vs another application automatically opening the browser to a link) Is this possible?

The endgoal of this project is to automatically open links in different browsers/browser profiles based on the link, and where the link came from. (eg: any link with app.slack.com in it opens in my work browser, any link with my development URL opens in my testing browser, all other links open in my normal browser)

wolfinabox
  • 83
  • 1
  • 4
  • No, all that is supplied to the protocol handler is the link itself along with any fixed command line switches set in the registry keys for the app launch command. If you want to know the source, that needs to be in the launch link (such as a CGI parameter for HTTP/S). – Dave S Jul 01 '23 at 20:26
  • You can find a PID of the parent process, this question might help: https://stackoverflow.com/questions/185254/how-can-a-win32-process-get-the-pid-of-its-parent – viilpe Jul 03 '23 at 21:47
  • For mailto: style protocol links, I'd expect the parent to be the desktop / Windows OS not whatever browser included the launch link. – Dave S Jul 05 '23 at 00:32

0 Answers0