List a local directory with chrome extension

前端 未结 1 1336
清酒与你
清酒与你 2021-01-12 10:14

I\'m trying to create a chrome extension which scans a local directory for new files ... However, if I add the file://* permission to the manifest I can access the internal

相关标签:
1条回答
  • 2021-01-12 10:39

    Any time I've had to do something on the local machine from a Chrome extension, I've always created a small program that accepts connections via HTTP, and does the work as a normal program, taking commands with JSON over POST. This gives you great flexibility, as it essentially allows you to write a Chrome extension that can do anything a desktop program can do.

    However, there are great downsides to this, and you should only do it if absolutely necessary. For instance:

    • You can't do this for all operating systems, unless you're going to write an agent for every OS.
    • The extension cannot be installed from Google's extension hosting.
    • You must write your own installation program that registers the extension.
    • There are very real security considerations to worry about with this. You will be opening up a web service that executes commands. Be very sure that you are not exposing the user. In all reality, if you are making a file browser, you probably are exposing the user. It will be up to you to fix this security hole, as if you were creating any other web service.
    0 讨论(0)
提交回复
热议问题