问题
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:
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)
来源:https://stackoverflow.com/questions/14713109/mimetype-handling-by-chrome-extension-packaged-apps