Interactuar con métodos locales desde una extensión de Chrome

I'm not sure which technology I should be using, or even what exactly I'm trying to do is called, so I was hoping to just get some guidance on the issue.

We have a client/server architecture, and from the client side you should be able to send a command to the server side either by going from Browser -> Client -> Server, or just directly from Browser -> Server

My question is, what should I be looking in to to help me accomplish this task? I believe if I were to use a Chrome Extension, it would have to use NPAPI to interact locally with my PC, which is less than recommended ;)

The solution only needs to work on Windows, and will not be accessing any of the local users files.

Gracias por su ayuda!

preguntado el 27 de julio de 12 a las 14:07

Can you give an example of the application flow? I don't see what you're looking for. -

Browser Extension -> Button on Browser Extension -> Interacting with the Local/Remote Machine methods in some way -> ??? - > Profit! I hope that makes it a bit more clear. Basically, if I provide an API in my Client/Server (irrelevant which one) how can I interact with it from the browser? -

The easiest method is to create a local server in your favourite language, which -after validation- calls predefined system methods. (You should nunca execute user input without a whitelist-based validation approach). -

1 Respuestas

Within Chrome Extensions, you are allowed to access external resources if and only if you explicitly define the permissions (url pattern) in the manifiesto archivo.

Depending on the need of your application, you could use RESTful server approach or WebSockets server approach. Once you finish developing your server, your extension can communicate through it using existing web technologies (XmlHTTPRequest, WebSocket).

Assuming your going to use RESTful, what I would do is create a JavaScript service class/library that communicates to your backend (Server) using XHR, and include that in your página de fondo within the extension. Then you can use Extension Message Passing to communicate to your service class.

Think of it as this, the scripts defined in the background context within your extension lives in between your extension and your server, acting like a facade. Search on GitHub/StackOverflow if you need questions regarding how, there are many useful posts/projects.

Respondido 28 Jul 12, 18:07

Thank you so much for this helpful answer. Definitely given me a good launching point on where to look. :) Very much appreciated! - DTI-Mate

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.