0

I'm trying to send data from my chrome extension to my .net application using ajax. I'm using background script to send data. Currently i'm unable to get data at my server. I guess there's issue in setting up manifest for chrome. However, how can i post data from chrome extension? Suggest any other alternatives if possible. Thank you.

2 Answers 2

1

You can send data to the server using XHR, or use jQuery.ajax() if you prefer. The end point will be the web service you have defined on the server. Check out this example, which uses jQuery for it.

For posting data, you pass all the data you want from the client in JSON format. You can use JSON.stringify() to convert your JavasScript object to a JSON string. If your object matches an entity structure on the server, it should automatically populate it, allowing you to specify that entity as the parameter of the web method. Otherwise, you can accept an object parameter and extract the data from that.

In a Chrome extension, make sure you have the correct cross-origin permissions.

Sign up to request clarification or add additional context in comments.

Comments

0

There is a specific mechanism in Chrome for communication with local applications: Native Messaging.

There is an important limitation to keep in mind: Chrome cannot talk to an already-existing process; it can only start a new one and talk over STDIO.

So you may need to have a "proxy" process that Chrome can start, which will connect (somehow, but no longer restricted in methods) to your main app and relay data.

2 Comments

I thought that's what you are doing already, and you were looking for alternatives. This is an alternative. POSTing to a local webserver is also valid.
You are right. I found it somewhere today. Thanks for your concern.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.