是否可以在 Google Chrome 扩展程序中嵌入 HTTP 服务器?
您认为可以在 Google Chrome 扩展程序中嵌入 HTTP 服务器吗?
Do you think it would be possible to embed a HTTP server inside a Google Chrome extension?
我见过其他 Google Chrome 扩展程序执行本机代码,显然他们使用 NPAPI,但我不知道那是什么.这真的让我很害怕,因为我不是 C++ 专家或类似的东西.所以我现在感觉有点卡住了,这就是我寻求帮助的原因.
I've seen other Google Chrome extensions execute native code and apparrently they do it by using NPAPI, but I have no idea what that is. And it's really freaking me out, as I'm no C++ expert or anything like that. So I feel a little stuck now and that's why I'm asking for help.
具体来说,我想为 Chrome 创建一个扩展程序,其功能类似于 Opera Unite.对于那些不知道我在说什么的人:Opera Unite 基本上是一个与浏览器捆绑在一起的零配置 Web 服务器.我不想将它用于 Opera 所做的相同事情,但我喜欢这个概念.
Specifically, I want to create an extension for Chrome with features similar to Opera Unite. For those who don't know what I'm talking about: Opera Unite is basically a zero-conf web server bundled with the browser. I don't want to use it for the same things Opera does, but I like the concept.
我正在考虑在浏览器中使用诸如 node.js 之类的东西来创建一个简单的 Web 界面来控制一些东西在浏览器中.将其视为浏览器的遥控器.如果 node.js 不可能,我想使用 lighthttpd 或类似的东西.技术真的无所谓,只要它允许我通过 HTTP 接收命令.
I was thinking about using something like node.js inside the browser to create a simple web interface to control some stuff in the browser. Think of it as a remote control for the browser. If node.js isn't possible I'd like to use lighthttpd or something similar. The technology really doesn't matter as long as it allows me to receive commands over HTTP.
但是我如何使用现有的 Web 服务器并从中制作 NPAPI 插件?
But how do I take an existing web server and make a NPAPI plugin out of it?
说明:我希望任何浏览器都能够与我的扩展程序通信.特别是我希望像 Android 或 iPhone 这样的移动设备能够远程控制浏览器.除了使用 HTTP 服务器之外,还有其他方法可以实现吗?
Clarification: I'd like any browser to be able to communicate with my extension. Especially I want mobile devices like Android or the iPhone to be able to remote control the browser. Is there any other way to accomplish that except with a HTTP server?
另一个更新:我认为最简单的方法是使用网络上的中继服务器,例如 Pusher 或一些自创服务.但我不喜欢这种方法,因为它需要不断地访问互联网,而且它是一项付费服务??.
Another update: I think the easiest way to do this would be to use a relay server on the web like Pusher or some self-created service. But I don't like this approach because it requires constant internet access and because it's a paid service.
谢谢大家!
推荐答案
以下是有关在 Chrome 应用中制作网络服务器的信息:https://developers.google.com/live/shows/7320022-5001
Here is info on making a web-server in a Chrome app: https://developers.google.com/live/shows/7320022-5001
相关文章