Skip to content

Instantly share code, notes, and snippets.

@phuoctamm
Created April 2, 2020 04:05
Show Gist options
  • Save phuoctamm/9c1fff694a40d0d950599127f7c8169a to your computer and use it in GitHub Desktop.
Save phuoctamm/9c1fff694a40d0d950599127f7c8169a to your computer and use it in GitHub Desktop.
// manifest.json
{
"web_accessible_resources": ["data.txt"] // add this
}
// get
const url = chrome.runtime.getURL('data.txt'); //path to file
fetch(url)
.then(response => response.text())
.then(response => console.log(response));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment