如何使用 POST 变量在 Firefox 插件中打开新选项卡?
如何使用 POST 变量在 Firefox 插件中打开新选项卡?
例如,使用以下 post 变量打开 http://localhost/:
a=NOMADE
b=NOWAY
another=IDONTKNOW
How I can open a new tab in a Firefox add-on with POST variables?
For example, open http://localhost/ with these post variables:
a=NOMADE
b=NOWAY
another=IDONTKNOW
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
gBrowser.addTab 函数就是您想要的。您传递给该函数的参数之一是
postData
,它允许您根据需要设置 postData。该函数的 MDN 文档还指向一篇关于预处理 POST 数据的文章 。如果我正确地阅读了第二篇文章,则 POST 数据需要以 nsIInputStream 的形式传递(具体创建为 nsIMIMEInputStream)。本文提供了一个示例代码片段,用于从标准 GET 样式格式字符串(例如:foo=1&goo=somestring
)转换为预期格式。编辑:因此,要使用您的示例,您可以执行以下操作:
The gBrowser.addTab function is what you want. One of the parameters you pass to that function is
postData
, and allows you to set the postData as you would like it. The MDN documentation for that function also points to an article on pre-processing POST data. If I read that second article correctly, the POST data needs to be passed in the form of an nsIInputStream (specifically created as nsIMIMEInputStream). The article provides a sample code snippet for converting from a standard GET style format string (example:foo=1&goo=somestring
) to the intended format.Edit: So, to use your example, you might do something like this: