问题
I have created a Native Client application for the Google Chrome web browser that plays special types of audio files. Great; that part works very well at this point.
I'm ready to move to the next phase-- sharing this app with the world. I need help with this part.
Per my understanding, the best method for distributing this app is to package it as a Chrome extension, uploading it to the Chrome Web Store (CWS), and using inline install from my website which contains the audio files. Further, this page describes how to associate MIME types with NaCl extensions. I have devised a custom MIME type for this file type.
So here's my question (I think): How do I load the Native Client app from inside the extension?
When I develop this program locally, there is an < embed > tag whose "src" attribute references a .nmf file that points to the .nexe files. The embed tag also has other parameters that are passed to the NaCl app. In the extension scenario, the .nmf and .nexe files (as well as an icon and a manifest.json file) live in the extension.
In the extension scenario, how does the web page specify that the NaCl app inside the extension needs to be loaded? Via an embed tag or some other mechanism? Am I supposed to load the file URL directly and trust that the MIME type will invoke the NaCl extension?
I apologize if this question is confusing-- this is a situation of not really knowing the right question to ask.
回答1:
You need to load a page or a content with the MIME type and browser will invoke NaCl extension and call HandleDocumentLoad
method.
来源:https://stackoverflow.com/questions/10845420/loading-a-native-client-chrome-extension-for-a-particular-mime-type