how to send request to python server from chrome extension

1,008 views
Skip to first unread message

Jayesh Pawar

unread,
Dec 25, 2011, 5:59:44 AM12/25/11
to Chromium-extensions
hi,
i want to pass url of current open page to python
server and display the output from server on extension. i want how to
make interface between python server and javascript.

Devin

unread,
Dec 26, 2011, 7:37:02 PM12/26/11
to Chromium-extensions
You'll want to learn about sending a message to the background page,
and triggering an ajax call. Either you can use jQuery, prototype, or
grab the GET method out my own Gen.js library: https://github.com/devinrhode2/Gen.js

Usage is documented right next to the methods, feel free to chop up
that code however you want, and even just use the raw inside of the
function.

You'll want to do this ajax call in the background page of course.

You may easily get the current tab by default depending on the chrome
method you use, otherwise there is a method in the docs you can use
from the background page.

-Devin
@DevinRhode2
(TheScoutApp.com)

Gildas

unread,
Dec 27, 2011, 8:52:13 AM12/27/11
to Chromium-extensions
Since chrome 13 content scripts can use cross-origin XHR [1]. The only
thing the poster must learn are XHRs [2]. There is no need to use a
background page or whatever library.

[1] http://code.google.com/chrome/extensions/xhr.html
[2] https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest
Reply all
Reply to author
Forward
0 new messages