Doable for http and https, but if you're running it in a browser environment, you'll eventually run into issues with CORS and other protocols. To get around this you need a proxy server running elsewhere that exposes the lower layers of the network stack.
This is exactly what [0] does. Try it out. If you know the IP you can even log in to another open browser window via telnet.
[0] https://github.com/s-macke/jor1k