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

前端 未结 2 1023
别那么骄傲
别那么骄傲 2021-01-16 23:43

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 param

相关标签:
2条回答
  • 2021-01-17 00:03

    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:

    • python version
    • java version
    0 讨论(0)
  • 2021-01-17 00:07

    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.

    0 讨论(0)
提交回复
热议问题