Have you used Chrome’s remote debugging feature? It is a handy tool for debugging JavaScript in another tab/window.
That’s nice, but have you ever wanted to debug JavaScript that was running on another machine running Chrome? If so, and you’re running on Mac OS, you’ve come to the right place.
The first step in this process is to disable Chrome’s same origin policy. This may not be necessary in your application but I’ve always found I needed to do it in mine.
Now you’ll need to make sure you have socat installed. The easiest way to do this is with Homebrew. Install Homebrew, and then run this command:
1
|
|
That will install socat if it isn’t installed already.
Now start Chrome remote debugging on the system that you want to connect to.
Next, get socat to relay traffic from port 9223 to port 9222 using this command:
1
|
|
Finally, try to connect to the remote computer using its IP address, not localhost with a URL like this:
1
|
|
You should be connected to the remote system’s debugger using port 9223.
When you are done be sure to do this to stop socat:
1
|
|