firefox-webextensions

Install a personal firefox web extension permanently

為{幸葍}努か 提交于 2019-12-04 02:40:33
Previously, I could write an addon for personal usage packed as something.xpi and I clicked on it to install it. After a while, mozilla introduced xpinstall.signatures.required which you could still get around it. However, it did not stop stabbing developers who are interested to have a personal addon isolated from the world. Today, only web extensions are working and my XUL based addon is thrown away. The tutorials only talk about temporary installation of a web extension while I want my one runs on firefox forever. Beside whether I can use web extension to write into files or create a GUI in

Asynchronous webRequest.onBeforeRequest URL inspection using Firefox native messages

非 Y 不嫁゛ 提交于 2019-12-02 16:08:09
问题 I'm trying to create URL inspector using Firefox native messages. The problem is, when native application sends a verdict, onBeforeRequest listener already released request, thus redirection doesn't happen. Can you please help to make my extension wait for reply for up to 2 seconds and redirect the request if answer is "0"? var port = browser.runtime.connectNative("ping_pong"); function inspectURL(requestDetails) { console.log("Loading: <" + requestDetails.url + ">"); port.postMessage

Injecting into navigation error page gets: Error: No window matching {“matchesHost”:[“<all_urls>”]}

折月煮酒 提交于 2019-12-02 13:19:28
I am trying to execute a script that shows a green border on the specified tab (by ID). The script should execute when the response for the requested URL is an error. The problem is that, when I load the extension from about:debugging , I get the following error (in the browser console in FF 53): Error: No window matching {“matchesHost”:[“<all_urls>”]} I searched for hours and hours and looked at several posts for similar problems but none of them have helped me. For example, this post suggests adding "<all_urls>" permission and it did not help in my case. Another post says that it is not

Extract cookie from chrome.webRequest.onBeforeSendHeaders

六眼飞鱼酱① 提交于 2019-12-02 10:51:10
I'm working on a Firefox add-on to intercept HTTP requests and extract the cookie. I was able to extract 'User-agent' from the header but was unable to extract the cookie. The code I used is below. chrome.webRequest.onBeforeSendHeaders.addListener(function(details){ var headers = details.requestHeaders, blockingResponse = {}; for( var i = 0, l = headers.length; i < l; ++i ) { window.alert("Checking headers"); if( headers[i].name == 'Cookie' ) { headers[i].value = 'twid=notsecret'; window.alert("Cookie Changed"); console.log(headers[i].value); break; } } blockingResponse.requestHeaders =

Migrating chrome extension to web extension

南笙酒味 提交于 2019-12-02 10:17:01
I have been migrating my extension from chrome to web extension. Link of chrome extension is here Everything worked except I need tab information inside my angular application, there I am getting an error as TypeError: "browser.tabs is undefined" I can access the tab info inside background script and I can send that to the content script but not in the main application. My application opens in iframe, iframe points to the angular application. browser.tabs.getCurrent(function (tabs) { //these are tabs }); I was able to get it in chrome extension , I can;t find a way to send it from background

Update WebExtension webRequest.onBeforeRequest listener URL settings from separate script

浪子不回头ぞ 提交于 2019-12-02 09:45:51
问题 I am currently creating a WebExtension in which I register a listener on the web requests being made, as such: main.js : chrome.webRequest.onBeforeRequest.addListener(main_function, {urls: sites}, ["blocking"]); where sites is an array containing a list of URLs loaded from a settings page. Upon changing these settings, which live in separate HTML and JavaScript files, I want to update the aforementioned listener to now contain the new list of sites. I'm having trouble getting access to this

change the button of a firefox-webextension into a textString

落爺英雄遲暮 提交于 2019-12-02 09:17:10
Currently I am building a webextension on firefox 47. When you click a webextension button, a drop-down menu appears, from there I can navigate to other websites. The button that is appearing is the icon I specified in manifest.json . I wonder if there is any way to change the icon of the extension to a text-string containing the URL I am currently visiting, and changes every time I visit a new URL. No, you can not directly change a browser action or page action icon into some long string of text. You can: Browser Actions : Change the icon using browserAction.setIcon() . This changes the image

Asynchronous webRequest.onBeforeRequest URL inspection using Firefox native messages

蓝咒 提交于 2019-12-02 07:37:58
I'm trying to create URL inspector using Firefox native messages. The problem is, when native application sends a verdict, onBeforeRequest listener already released request, thus redirection doesn't happen. Can you please help to make my extension wait for reply for up to 2 seconds and redirect the request if answer is "0"? var port = browser.runtime.connectNative("ping_pong"); function inspectURL(requestDetails) { console.log("Loading: <" + requestDetails.url + ">"); port.postMessage(requestDetails.url); console.log("Posting complete <" + requestDetails.url + ">"); } port.onMessage

Javascript does not run on local page

≡放荡痞女 提交于 2019-12-02 00:14:23
问题 I have a very simple webextension that is supposed to open a local page in a new window when a button is clicked: function openMyPage() { var popupURL = chrome.extension.getURL("my-page.html"); chrome.windows.create({ url: popupURL, type: "popup", height: 200, width: 200 }); } chrome.browserAction.onClicked.addListener(openMyPage); Inside my-page.html I want to run some javascript but I can't get it to work. Even a simple script does not execute: <html> <body> <script type="text/javascript">

Firefox WebExtension: Check if MY extension exists

戏子无情 提交于 2019-12-01 21:27:54
Porting extension from Chrome into FF Followed this tutorial (which works fine in Chrome): http://www.codingscripts.com/check-whether-user-has-a-chrome-extension-installed/ Sending message from webpage to extension: In (web)pagescript.js this has: function IsExist(extensionId,callback){ chrome.runtime.sendMessage(extensionId, { message: "installed" }, function (reply) { if (reply) { callback(true); }else{ callback(false); } }); } IsExist("Your extension id",function(installed){ if(!installed){ alert("Please install extension "); } }); Receiving message from webpage in extension: chrome.runtime