I'm currently working on developing a Firefox Addon using the new WebExtensions system.
My goal is to:
- Extract specific text from a webpage (not owned by me)
- Evaluate it using an external website
- Display the result on the same page
The issue I'm facing is making the web request within the addon (point 2). It seems like XMLHttpRequest could be a possible solution, but due to security measures, accessing remote paths might not be allowed.
It appears that the JavaScript code runs inside the page, even though I initially thought the addon would function externally.
While the end result should appear within the page, I believe the addon could act as a proxy for this request. However, I am uncertain about how to approach this and what steps to take.
I prefer not to resort to unconventional methods (such as bypassing security controls), and instead, aim to follow the correct procedures.
Furthermore, I am unsure if addons are restricted to running only within the pages they were created for.
EDIT: Upon further research, I discovered that the Chrome documentation may provide better insights than Mozilla's. To enable the XHR for cross-site requests, an additional line of code needs to be added to the manifest file:
{...
"permissions": [
"http://random.com/"
],
}..
Despite this revelation, I remain uncertain if this method aligns with my intended goals.