简体   繁体   English

从Firefox插件发送帖子请求

[英]sending a post request from firefox addon

I am currently working on an addon and it had a addon window with addon buttons and a tab in main window it maintains. 我目前正在开发一个插件,它有一个带有插件按钮的插件窗口和一个在其维护的主窗口中的选项卡。 I am able to open a page in main tab by 我可以通过以下方式在主标签中打开一个页面

mainWindow().location = "http://murmuring-retreat-7618.herokuapp.com/signin";

I created mainWindow by following way 我通过以下方式创建了mainWindow

getBrowser().getBrowserForTab(bridge.recordingTab).contentWindow;

where I have already saved bridge.recordingTab as the tab I am connected. 我已经将bridge.recordingTab保存为我连接的选项卡的位置。

but if I want to send a post request instead of just open a url, how do I do it? 但是,如果我想发送一个发布请求,而不只是打开一个网址,该怎么办?

If you use jQuery in your firefox addon then you could simply do a $.post 如果您在Firefox插件中使用jQuery,则只需执行$.post

Note though that you need the destination server to be CORS enabled , otherwise you can only do JSONP requests using $.getJSON 请注意,尽管您需要将目标服务器启用CORS ,否则只能使用$.getJSON进行JSONP请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM