firefox-addon-sdk

Intercept download link click and prevent default download dialog

这一生的挚爱 提交于 2019-12-25 02:59:24
问题 We have built a download manager desktop application for windows. Now we want to add a feature that intercepts download links and adds them to the application. We think we should write an addon for each browser starting from Firefox. To intercepts download links for a download manager, is writing addons the best choice? How can we do that? Things we've tried so far: - Using Downloads.jsm to observe new downloads, then cancel them => We don't want the user to interact with Firefox's download

Bundle Addons with Firefox Mobile (Fennec)

十年热恋 提交于 2019-12-25 01:49:50
问题 How to Bundle Addons with Firefox Mobile (Fennec) for Android ? I would like to include several add-ons on the build process in a away that users could start using them immediately. I've searched Mozilla Wiki and couldn't find any relevant information about this. tks. 回答1: I've found the answer: To create a distribution build locally, put your distribution folder at objdir/dist/bin/distribution, then package the app as you normally would. The distribution files will be copied out to /data

Firefox SDK: Redirect to ressource HTML denied

不羁的心 提交于 2019-12-24 16:42:46
问题 I'm trying to write a Firefox Addon with the Addon SDK to redirect some websites based on their URL. I have created a HTML page and put it in the data directory. I get the path with: var data = require("sdk/self").data; var myWebsite = data.url("myWebsite.html"); I'm using PageMod to start a script given an array of URLs: pageMod.PageMod({ include: ArrayOfUrls, contentScriptFile: "./myScript.js", contentScriptOptions: {"myWebsite" : myWebsite} }); In myScript.js I'm checking if some

How to change Panel Size in mozilla like chrome extension

混江龙づ霸主 提交于 2019-12-24 16:30:08
问题 Panel Size is fixed in SDK-based Add-on I want to change the size of panel automatically like chrome dictionary extension here If you will search in panel it will show big and small data like content requirement. In Mozilla panel we can fix only 1 type of size like width:400px and height:400px etc. but i want that panel size should based on data size means like chrome extensions. 回答1: You can implement this in the Add-on SDK with a little extra code. In main.js: var panel = require("panel")

How to inject script locally in firefox add-on

我是研究僧i 提交于 2019-12-24 15:42:31
问题 I have published a add-on in mozilla add-on website, it got rejected because of remote scripts. lib/Main.js: var data = require("sdk/self").data; var pageMod = require("sdk/page-mod"); var _workers = []; pageMod.PageMod({ include: "some url", contentScriptWhen: "ready", contentScriptFile: data.url("./inject.js"), contentStyleFile: data.url("style.css"), attachTo: 'top' }); data/inject.js: var script = document.createElement('script'); script.type = "text/javascript"; script1.src = "https:/

Firefox Add-On window.addEventListener error: window not defined

我怕爱的太早我们不能终老 提交于 2019-12-24 13:34:00
问题 i'm trying to follow this tutorial for creating a firefox addon that intercept when the url in the address bar change: https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Progress_Listeners#Example:_Notification_when_the_value_in_Address_Bar_changes I just copied the code, and just added an alert to see if it works, but i can't have it run in any way. My code is: const {Cu} = require("chrome"); Cu.import("resource://gre/modules/XPCOMUtils.jsm", this); var urlListener = { oldURL: null,

Updating my Firefox extension - autoupdates not working

这一生的挚爱 提交于 2019-12-24 13:25:55
问题 My Firefox extension is not hosted on the official extension site. It is hosted on a secure (https) server. From what I have read, I do not need to sign my add-on, right? The problem is that it is not working. I install my plugin, and click on 'Check for updates', but it says no updates have been found. I have set the version in the update manifest and in the install manifest from initial.rev332 to initial.rev333. Could someone shed some light on my situation? Thanks very much :) My install

Replace complete HTML by mozilla addon SDK

牧云@^-^@ 提交于 2019-12-24 08:38:14
问题 Is there a way to replace the complete HTML, and add additional javascript files with mozilla addon SDK? With chrome it can be done by running the script at "document_start", stop the window and replace the complete HTML with an XHR response. I don't understand why is this so complicated, but I can live with that. As far as I understand the addon SDK has a page-mod module, which is about "running scripts in the context of web pages whose URL matches a given pattern." So in theory this should

Firefox extensions and full file paths from HTML form?

六月ゝ 毕业季﹏ 提交于 2019-12-24 06:38:29
问题 I have built a Firefox extension using the Addon SDK that opens up a new tab with a HTML page from the extensions directory and attaches a content script to it: function openHtmlLoadFormTab(htmlFileName, jsWorkerFileName) { tabs.open({ url: data.url(htmlFileName), onReady: function(tab) { var tabWorker = tab.attach({ contentScriptFile: [ data.url(jsJquery), data.url(jsWorkerFileName) ] }); } }); } I have an <input type="file"> in the HTML file and some code that handles the "submit" event in

Can't write to file NS_ERROR_FILE_UNRECOGNIZED_PATH

扶醉桌前 提交于 2019-12-24 05:44:10
问题 I try to write in file using sdk. var fs = require('sdk/io/fs'); fs.writeFile('text.ini', '123', null, function (error) { callback(error); }); But i obtain NS_ERROR_FILE_UNRECOGNIZED_PATH . Which path should I use? 回答1: You can obtain special directories' path with sdk/system . const { pathFor } = require('sdk/system') const path = require('sdk/fs/path'); // important for cross-platform compatibility var profile = pathFor('ProfD'); var filepath = path.join(profile, 'text.ini'); // now pass