firefox-addon-sdk

How do I display a link in a panel on my Firefox Extension using the Add-on SDK?

五迷三道 提交于 2019-12-12 03:54:03
问题 I'm currently making a Firefox extension using the Add-on SDK (widget). What I'm trying to do upon the widget being clicked is: Identify all addresses on a webpage, highlight the addresses, and show a panel (attached to the widget) with links to Google Maps with the address. The issue I am having is displaying a link in the panel. I have been able to open and display actual sites and HTML files in the panel, but would like to know how, if possible, to display a clickable link in the panel. I

Programmatically bookmark pages in bookmark toolbar using firefox extension

不打扰是莪最后的温柔 提交于 2019-12-12 03:26:40
问题 I'm trying to make a firefox extension that bookmarks the current page and adds an entry in the bookmarks toolbar. Using the example in the documentation found here I was only able to only bookmark a link but not make it appear in the bookmarks toolbar. I was unable to find anything helpful in the documentation or on google related to this. Here's my code: let { Bookmark, save } = require("sdk/places/bookmarks"); // Create a new bookmark instance, unsaved let bookmark = Bookmark({ title:

Save web pages with Firefox addon using file -> save as pop-up window

自作多情 提交于 2019-12-12 02:52:07
问题 Let me start off by saying I am new to add-on development. Using the Add-on SDK, I am trying to create a simple Firefox add-on that, when a button is pressed, acts like pressing the Ctrl-S hotkey, or following the file -> save page as to get the save page pop up window. I have looked at similar questions on here, but they seem to be going around the built in save functions, and not utilizing the "save page as" window. The end goal is to run other functions before the save call is made. The

How to set custom cookies using Firefox Add-on SDK (using Services from Firefox Add-on SDK)

坚强是说给别人听的谎言 提交于 2019-12-12 02:45:55
问题 I am working on creating a Firefox Add-on SDK extension that would set custom cookies (two cookies with name and value attributes) on Firefox v41, with jpm . Essentially, if I open the add-on's Panel() and click on set, the cookie values should be set. On refresh, I should be able to see them on my developer console, in which ever tab I open. And, on reset, they should be removed. I tried modifying the code snippet from the Add-ons Code snippets -> Cookies on Mozilla's developer website:

Receiving binary data using request module in Firefox Add-on SDK

左心房为你撑大大i 提交于 2019-12-12 02:28:59
问题 I am using the Add-on builder and I need to receive binary data (image). I would like to do this using the request module but as you can see from the documentation: https://addons.mozilla.org/en-US/developers/docs/sdk/latest/packages/addon-kit/docs/request.html There are only text and json properties and raw is absent. How should I receive binary data in the add-on script? 回答1: You cannot do this using the request module, you will have to use the regular XMLHttpRequest via chrome authority.

How to enable debuging when using jpm run to test a Firefox Add-on SDK extension

[亡魂溺海] 提交于 2019-12-12 01:42:48
问题 Can somebody tell me what is required to turn on a debugger when testing a Firefox Add-on SDK extension on Windows 7, 64 bit. I'm launching the add-on via the command line with the command jpm run . I've tried bring up the debugger via F12 . But, I can't see my JavaScript file(s) there. A step-by-step guide would be useful. 回答1: Use the command jpm run --debug. Then click on "OK" when asked to accept the incoming connection: ? You will then have a debugger window from which you can select

How to add button in toolbar of print preview fire fox using add SDK

亡梦爱人 提交于 2019-12-12 01:32:19
问题 How to add button in toolbar of print preview fire fox using add SDK. thank you so much 回答1: function addToolbarButton() { var {Cc, Ci, Cu} = require("chrome"); var mediator = Cc['@mozilla.org/appshell/window-mediator;1'].getService(Ci.nsIWindowMediator); var document = mediator.getMostRecentWindow("navigator:browser").document; var navBar = document.getElementById("print-preview-toolbar"); if (!navBar) { return; } var btn = document.createElement("toolbarbutton"); btn.setAttribute('type',

Get nsIDOMWindow of a Tab to do Text Input

萝らか妹 提交于 2019-12-12 00:42:33
问题 Is it possible to use Text Input Processor on a specific Tab of a Firefox window? Do all the tabs share the same nsIDOMWindow object? If so, then is there any other solution? Rephrasing my problem: I want to type text to a specific tab, and if there is more than one, then it might not be the current. Below is an example code to write text on any Firefox window, but only for current tab: function myTestFunc() { // var windows = Services.wm.getEnumerator("navigation:browser"); var windows =

ReferenceError while using sdk/tabs in firefox webextension

心不动则不痛 提交于 2019-12-12 00:38:45
问题 This is my first time learning to build a firefox addon. I want store all the open tabs in a window and for that I require sdk/tabs. Here is my js file: /* Given the name of a beast, get the URL to the corresponding image. */ debugger; var tabs = require("sdk/tabs"); function beastNameToURL(beastName) { switch (beastName) { case "Save Session": debugger; for (let tab of tabs) console.log(tab.url); return; case "Load Session": debugger; return chrome.extension.getURL("beasts/snake.jpg"); case

Firefox extension addon tab using background script

℡╲_俬逩灬. 提交于 2019-12-12 00:28:43
问题 I have a firefox extension that opens up a tab with a html file that is located in my data folder. The main.js does this: function handleClick(state) { tabs.open("login.html"); } In main.js I require() a bunch of scripts to run as background scripts. This html file acts as the "login" for the extension. How can this html page have access to the background scripts? 回答1: It can't. You'll need to attach a content script to your login page and to send variables to it the standard way using port.