How can i send data from chrome extension to localhost?

最后都变了- 提交于 2019-12-04 20:15:14

Simply post your data to localhost server.

Just remember to add permission in manifest.json.

{
    "manifest_version": 1,      
    "name": "Your Extension",
    ...

    "permissions": [
        ....
        "http://localhost:1234/"
    ]
}

Second version would be via app network in Chrome https://developer.chrome.com/apps/app_network

But this requires more low level programming.

The basic steps (sample code contained in the following links) would be:

  1. Add your local server url to permissions field in manifest.json
  2. Use Ajax, Websocket, Nativemessaging (You would need nativeMessaging permission instead), or any other communication method to exchange data between extension and your local server.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!