Investigate `GM.fetch` implementation
Similar to GM.xmlHttpRequest, but more modern. Support for streaming features etc.
Investigate whether Cross-origin access can be achieved with something like GM.xmlHttpRequest or otherwise.
Compared to XMLHttpRequest this may be a more complex and bulky wrapper and bridge.
The goal is to follow the standard Fetch API as much as possible.
GM.fetch is just a temporary name, which may be different according to the actual situation.
There is no ETA.
I have implemented a similar thing in this repo.
related code: https://github.com/yetone/openai-translator/blob/ffe58e170d49480f2d2c417c8de2b2c2d039104f/src/background/index.ts#L28 https://github.com/yetone/openai-translator/blob/main/src/common/background-fetch.ts
what do yout think? willing to send a pr to support streaming feature.
@maltoze Thank you for your comment. I need to learn more to accurately assess this issue, which may take some time.
WebSocket feature in userscript similar to GM_xmlhttpRequest like GM_webSocket.
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API
Motivation
I want to use websocket for request with url wss://. It is not possible with GM_xmlhttpRequest, I have tried but the request changed to https.
Proposed Solution
Similar to WebSocket class present in browser.
Use Cases
@kryptoniancode I don't understand what you are talking about.
Are you having problems using original WebSockets_API directly?
xhr is not the correct API for ws, as well as fetch, why are you commenting under this issue?
@kryptoniancode
As far as I know, currently WebSocket is not subject to CORS policy.
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#what_requests_use_cors
If you do find this has changed, please cite your sources.
According to the error log you quoted, you are experiencing a CSP issue.
Currently page context CSP restrictions in Safari cannot be bypassed. Refer to #106
Thanks, I have check on some checked on some website it is working.