firefox-webextensions

How to trigger an event only when the user changes the URL?

ε祈祈猫儿з 提交于 2019-12-28 07:04:31
问题 I am working on a Chrome extension, I want to detect when the user has typed a URL. I know about: chrome.tabs.onUpdated.addListener(eventLisenerObj.onUpdated); But, it gets called whenever the URL is changed (e.g. when the page is auto reloads, or user clicks on a link, etc.) I desire to be able to determine that the URL was changed only by the user typing a URL. 回答1: You can get this information using the webNavigation.onCommitted (MDN) event. The event listener receives a property

Firefox WebExtention won't load

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 18:35:00
问题 So, I tried to load my add-on using the about:debugging page in Firefox. But, it simply wouldn't load. Is there somewhere where an error would be logged that I could find it? Here is my manifest.JSON code: { "description": "Adds a stickfigure", "manifest_version": 2, "name": "StickMan", "version": "1.0", "icons": { "48": "icons/StickMan-48.png" }, "applications": { "gecko": { "id": "extention@stick.man", "strict_min_version": "45.0" } }, "permissions": [ "activeTab" ], "background": {

TypeError: browser is undefined (Web Extension Messaging)

て烟熏妆下的殇ゞ 提交于 2019-12-24 17:16:09
问题 I am trying to communicate my web page script with my content script of my web extension with the code below Web Page Script const browser = window.browser || window.chrome; browser.runtime.sendMessage(message, function (response) { console.log(response); } ); However, I keep getting the error TypeError: browser is undefined . The same goes if I use chrome.runtime.sendMessage() instead. How am I supposed to use this method? 回答1: The issue here is that user/webpage scripts (unprivileged

location.href="javascript:Function(); isn't working for Firefox extensions

半腔热情 提交于 2019-12-24 09:37:31
问题 In Chrome web-browser extensions I can use the next method for calling/triggering a web-site's (page) js function: location.href="javascript:SomeFunction(); void 0"; It works great. But it doesn't work for Firefox Though in old Firefox addons I could call web-site's js functions in similar way like this: var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var mainWindow = wm.getMostRecentWindow("navigator:browser");

Force Proxy re-authentication in Chrome Extension

别等时光非礼了梦想. 提交于 2019-12-24 08:25:44
问题 I'm making an extension which allows users to store proxy servers with auth credentials (user/pass) and switch between servers. I am listening for the webRequest.onAuthRequired event and when the server challenges for auth, proving the username/password the user has saved, as per the provideCredentialsSync example here: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/onAuthRequired#Examples The problem is that when these credentials are provided, they

Javascript shell command execution from Firefox web extensions

*爱你&永不变心* 提交于 2019-12-24 05:45:07
问题 It's been noticed by all web extension developers that Firefox is going to stop SDK support (API that allows shell execution in client side) and will only accept web extensions. Due to above-mentioned changes, I'm trying to get a shell command executed by javascript code in Firefox's web extensions' API. I'm dealing with a web page that executes the web extension (I solved it by using javascript events), but the real trouble is that I need to execute a shell command in the javascript main

How to package an unsigned Firefox WebExtension?

我的梦境 提交于 2019-12-24 01:10:12
问题 I'm trying to develop an extension to run on the FirefoxDeveloperEdition (which doesn't require signing) on mac. I followed the "Your first WebExtension" guide and everything works fine when using the "Load temporary add-on". But when I try to package it and install it using the "install add-on from file", it shows "this add-on could not be installed because it appears to be corrupt". I zip all the files (borderify.js, manifest.json, icons, without the container folder) and change the suffix

Fetch api does not work in webextensions

让人想犯罪 __ 提交于 2019-12-23 21:26:17
问题 I'm experimenting firefox webextensions. I'd like to make HTTP requests using the fetch API after submitting a form. The problem is that the fetch request is not doing anything. Here is the data extracted from my manifest.json: "browser_action": { "default_popup": "test.html" }, "permissions": [ "<all_urls>" ], Here is my test.html: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <form> <button type="submit">Submit</button> </form> <script src="test.js"></script> </body> <

How to open a Firefox WebExtension options page as a tab, separate from about:addons

强颜欢笑 提交于 2019-12-23 17:25:25
问题 So, I've looked through the WebExtensions API, but I haven't been able to figure out how to open an HTML page separate from about:addons for options. In the Add-on SDK you could have resource://ext-id-/path/to/file.html . I've tried making a directory web accessible and putting an HTML file in there, but that didn't seem to work. Does anyone know how I can open the options HTML file in it's own tab with WebExtensions? 回答1: Opening a tab Options page always in a tab: If you want your options

How do I programmatically download a file created on the file with a Firefox WebExtension?

与世无争的帅哥 提交于 2019-12-23 10:49:30
问题 I am trying to port a Chrome Extension that programmatically creates and downloads a file to a Firefox WebExtension, using Firefox 45.0.1. This is the Javascript code: text = '{"greeting":"Hello, World!"}'; var a = document.createElement('a'); var file = new Blob([text], {type: 'text/json'}); a.href = URL.createObjectURL(file); a.download = 'hello.world'; // Filename a.click(); // Trigger download All lines seem to execute fine, but no file is downloaded (I put a console.log() after the a