I'm trying to send a file from my webpage to my chrome extension but I don't have a clue how to do it. Could somebody help me please?
Cheers! Imox
I'm trying to send a file from my webpage to my chrome extension but I don't have a clue how to do it. Could somebody help me please?
Cheers! Imox
You can send the file's URI to your server. Then your server-side code will download it from the page into the server and process it.
Then proceed to the following steps:
web_accessible_resources
property in the manifest.json
filechrome.runtime.getURL('path/to/file')
.Make a GET request to the URL:
const url = chrome.runtime.getURL('path/to/file');
fetch(url)
.then((response) => response.json()) //assuming file contains json
.then((json) => doSomething(json));
Related SO post:
Related Blog Post:
Chrome Extension Documentation: