JSONP in UserJS Chrome

Tell me how to implement JSONP in UserJS Chrome? I understand that extensions do not have access to the global object?

1) i.e. you cannot declare myCallback make the script return myCallback(JSON)

To access returned by the script:

2) callbackVar = JSON, to be able to remove globalObj[callbackVar], as well as the possibility to timeout to give the error message
3) well, or callbackVar var = JSON

also does not work.

You want to migrate from Opera UserJS.
October 10th 19 at 14:22
1 answer
October 10th 19 at 14:24
Content scripts of extensions run in their sandbox. So to intercept the request (as I understand it, you want it personalized), sent the page will not work. The only method of communication in this case — through the DOM tree, it is common.

If you need from the content script to send crossdomain AJAX request — this is done by communicating with the Background Page, which then sends a request, gets the result and gives it to the content script via, again, of the message.

Find more questions by tags JSONGoogle Chrome