Zeynel
Zeynel

Reputation: 13515

How can I pass an url parameter from my app to the Chrome extension?

In my Google App Engine app I want to pass this user information

    user = users.get_current_user()

to the Chrome extension in a url paramenter when the user clicks a button in the app.

How can I do this?

I read about Cross-Origin HMLHttpRequest but that seems about sending info to the app not about receiving.

This is a follow up to my other questions on this subject.

Upvotes: 0

Views: 1101

Answers (2)

Nioan
Nioan

Reputation: 11

This is from a while ago, but just in case someone stumbles upon it as I did today.

Sending the user email as a URL parameter is totally unsafe. Anyone using curl or their browser can make requests pretending to be any random user. If users can alter data with their requests, or if they should not be able to see each others data then you shouldn't follow this approach.

You should use GAE's cookie based user's service instead:

Upvotes: 1

PeteLe
PeteLe

Reputation: 1945

You can't pass information to the background via a URL parameter like this, but you've got a couple of options.

Probably the easiest way to do this would be to have the extension inject a content script in to your app. Since the content script runs in the context your your web app, it has access to the user details and any other information you might want to pass.

Then, via Message Passing (see http://code.google.com/chrome/extensions/messaging.html), you could send a message to the background page with the information that you're trying to send.

Upvotes: 1

Related Questions