I have a Chrome extension that injects HTML (generated by JS) through an iframe into the current tab's page. However, due to some code I'd like to protect (sandbox), I am thinking to use NaCl (Native Client) somewhere in the process to create a web view instead of using JS. The NaCl code would be initiated once the plugin is called and would do its calculations etc and render a web view that is sent back to the Chrome extension to inject.

Would this work? If so, where would you recommend I should start?

有帮助吗?

解决方案

Yes, that should work just fine. You will still need a little bit javascript to create the NaCl module and communicate with it. Communication with the NaCl module can only be done via the postMessage() API, so you need to post your request to NaCl and when wait for its reply. If you make the reply an html fragment then you should be able use javaScript to inject this into your iframe in the same way that your doing today with JS.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top