0

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

1 Answer 1

0

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:

  1. Add file path to the web_accessible_resources property in the manifest.json file
  2. Get the URL of the file using chrome.runtime.getURL('path/to/file').
  3. 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:

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.