目标
- 网页上点击按钮发送消息, 桌面exe应用能收到该消息
- 桌面应用发送消息, 网页能收到该消息
简述
chrome extension 也叫 谷歌插件, 主要由popup页面, background.js 和content-scripts.js组成.
通信的链路是[页面 <---> content-script.js <---> background.js <---> NativeMessageHost.exe <---> 应用.exe]
页面与content-scripts.js通信
content-script.js与background.js通信
background.js与NativeMessageHost通信
通信协议
NativeMessageHost与应用.exe通信
参考:
网友评论