Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to read local file in user's device by absolute path, such as /Users/xxx/abc.txt #773

Open
lanistor opened this issue Nov 8, 2022 · 6 comments
Assignees

Comments

@lanistor
Copy link

lanistor commented Nov 8, 2022

No description provided.

@guest271314

This comment was marked as off-topic.

@lanistor
Copy link
Author

lanistor commented Nov 9, 2022

@guest271314 Will throw error: Fail to Fetch

const url = chrome.runtime.getURL('/Users/Shared/test.js');
  console.log('>>getUrl', url);
  fetch(url).then((response) => {
    if (response.status !== 200) {
      console.log(`Looks like there was a problem. Status Code: ${response.status}`);
      return;
    }

    // Examine the text in the response
    response.text().then((data) => {
      console.log('####', 'data', data);
    });
  }, console.error);

@guest271314

This comment was marked as off-topic.

@guest271314

This comment was marked as off-topic.

@lanistor
Copy link
Author

lanistor commented Nov 9, 2022

So there is no way to read file on user's device outside extension's directory.

@guest271314

This comment was marked as off-topic.

@patrickkettner patrickkettner self-assigned this Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants