A bit of context:
I have a website with links to VNCs for our team to use -- those VNC URLs are formatted like this:
vnc://000.000.0.0:5901
Most of our team uses Macbooks, and MacOS handles these urls by default to open Screen Sharing. However, one of our team members uses a PC, and needs to set up a custom url protocol.
Here's what we've tried so far
Added the following using the Registry Editor:
HKEY_CLASSES_ROOT/
vnc/
(Default) "URL:vnc Protocol"
URL Protocol ""
shell/
open/
command/
(Default) "C:\Program Files\RealVNC\VNC Viewer\vncviewer.exe" "%1"
This got us 99% of the way there -- clicking on the URL opens the app 'VNC Viewer', and passes the url. However, VNC Viewer fails to open this properly, because for some reason, it tries to open "vnc://000.000.0.0:5901/" (added a trailing / character).
The error I get is:
Invalid endpoint: port not correctly specified
What do I need to do to get it to remove/filter out the trailing "/" character?
Thank you!
References
How do I register a custom URL protocol in Windows? How do I create my own URL protocol? (e.g. so://...)
I wasn't able to isolate the source of the trailing slash (/) appended to the url. I read several articles that seemed to suggest the browser (I'm using Chrome, but same thing happened on Microsoft Edge) was adding this -- something about the DirectoryIndex.
Anyhow, I was able to put together a workaround by:
Creating a batch file to format the url
This batch file takes the url, and:
Start & end quote marks -- The string passed was "vnc://000.000.0.0:0000/", and it removes the
"vnc://and/"from the string (using first 7 characters and last 2 characters)Calls VNC Viewer, passing the new formatted url as a parameter.
vnc-url-handler.bat
You can create this on Notepad, and save it as the proper file format.
Modifying Registry Key to point to the Batch file, instead of my app
This worked in Windows 10, Chrome 83.
There will be a command prompt window opened each time it opens VNC Viewer, but you can close it (or it will close when you close your session of VNC Viewer). I didn't figure out how to do this yet, but low priority for me.