Mimetype handling by chrome extension (packaged ap

2019-08-23 00:45发布

I'm wondering if a file, with a given mimetype, can be handled by a packaged app.

I saw that in manifest file, the nacl_modules could be used to associate a native client module with a mimetype.

I need my packaged app to handle desktop files with a specific mimetype.

As packaged app could be up and running without Chrome being displayed it seems possible, but the question is how !

Thanks for your advice and comments.

Guy

1条回答
冷血范
2楼-- · 2019-08-23 01:26

You can handle files using this manifest section: http://developer.chrome.com/trunk/apps/manifest.html#file_handlers

   "file_handlers": {
     "testhandler": {
       "title": "TestHandler",
       "types": ["*/*"]
      }
    },
   "permissions": ["fileSystem"],

The selected file(s) will then be passed in the launchData param of onLaunched event handler.

Notice that this is not yet available when launching from a file manager on platforms other than ChromeOS. On those platforms, it will only work now if you execute the app from the command line with the filenames as parameters (http://developer.chrome.com/trunk/apps/first_app.html#open)

查看更多
登录 后发表回答