Reputation: 16345
Say I have a local daemon running on my machine, and I want to talk to the daemon from a Greasemonkey script. I know that one of the core concepts of site JavaScript is that it is isolated from everything else, but I was wondering if there was a workaround.
One of the ideas I had was to use a WebSocket to send data to the local daemon but they are only available on Webkit based browsers.
Upvotes: 1
Views: 1622
Reputation: 93613
Three possibilities:
Give the daemon web-server capabilities and then use normal AJAX techniques via GM_xmlhttpRequest()
to interact with it.
Instead of a GM script, make a Firefox add-on. Add-ons can interact with the local system in much more dangerous ways than a GM script can.
I do not recommend this last approach, but include it for completeness... It may be possible for the daemon to read and/or write Firefox cookies or localStorage. GM scripts can also, but XSS restrictions apply here (unlike with GM_xmlhttpRequest()
).
Upvotes: 4
Reputation: 2894
You could get the daemon to accept HTTP requests, which are done very easily using JavaScript? I think you are going to need to improve the daemon here, rather than the script itself - JavaScript is very secure, and Greasemonkey just takes that a step further.
Upvotes: 1