开发者

Is it possible to send a URL from javascript running on the browser to the python program running on the client machine?

Can I send the url of t开发者_高级运维he page from the javascript to the python program running on the client machine ??

Also can I redirect the output of the python program to the javascript to be displayed on the browser?


You can if you're running a server with Python.

Create a simple server with python and return json. The only requirement is that the python server must be started in order to except requests.


In case you want to use XMLHttpRequests you might run into problems that cross-domain requests are not permitted. See http://en.wikipedia.org/wiki/XMLHttpRequest#Cross-domain_requests for details. In case the 'send' action can be triggered by user input, e.g. clicking on a link or submitting a form, you can specify the Python server URL as the form action target or the href of the link.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜