Is there some way to make XHR calls using the Execute JavaScript in Chrome action?
I’m intrigued as to why you think that might not work.
It’s just that I haven’t seen any discussion nor examples concerning the subject and therefore assumed there’s something tricky about it.
Also, I do not know enough about the Keyboard Maestro implementation to fully understand how it executes the JavaScript code within the browser - using AppleScript API as a bridge I suppose?
I assume cross-origin policies are not a problem, but how about the asynchronous nature of the request? What would be the proper way to capture the response and store it into a macro variable?
I think I tried a synchronous call once and, in addition to them being deprecated in Chrome, it also caused the browser tab to freeze.
If there is no reason it would not work, I guess I have to try again. Naturally, examples would be helpful as well. Or even a dedicated XHR action .
Okay. I had to try it again. The synchronous request seems to work as expected apart from Chrome warning about it being deprecated.