开发者

How to IPC Chrome with my app?

开发者 https://www.devze.com 2023-02-06 23:43 出处:网络
What is the simplest way to send text data from chro开发者_运维技巧me\'s javascript (running in a extension) and my external app? I saw XHR, but I don\'t want to use it cause it can be blocked by fire

What is the simplest way to send text data from chro开发者_运维技巧me's javascript (running in a extension) and my external app? I saw XHR, but I don't want to use it cause it can be blocked by firewalls.


XHR is the way to go. It shouldn't be blocked by any firewall because it comes as a regular browser request, similar to retrieving external js file or image. Using anything else would look rather fishy.


You can implement HTML5 WebSockets. http://www.html5rocks.com/tutorials/websockets/basics/

On your external app, you define the WebSocket server (many many implementations out there for many languages). And you just connect through it in your Extension. You can specify any port you please by allowing your WebSocket to listen to it.

0

精彩评论

暂无评论...
验证码 换一张
取 消