简体   繁体   中英

How can i send data from chrome extension to localhost?

I am creating a google chrome extension to read my History of browser. All works done. Now i am willing to send the retrieved history data to my localhost server . Is this possible? How to do this? Please anyone help me.

Thanks in advance.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM