All Questions
Tagged with firefox-addon-webextensions content-script
25 questions
0
votes
1
answer
87
views
EventTarget doesn't work in Firefox content script, does work in Chrome
In Chrome extension content scripts it is fine to do:
const myTarget = new EventTarget()
myTarget.addEventListener('test', () => console.log('test1'))
myTarget.dispatchEvent(new Event('test'))
but ...
0
votes
0
answers
64
views
Can website js read web extension console.log
I am in the process of developing a web extension (for firefox) and use console.log a lot during the development process. I do not want my extension to be detected by the website itself, therefore my ...
0
votes
1
answer
380
views
Sending message from background script to content script (multiple browsers)
I have a working prototype of an extension that works on Chrome but when I try to run it on Firefox i get the following error:
Unchecked lastError value: Error: Could not establish connection. ...
0
votes
1
answer
97
views
Content-script extracting data from HTML?
I am trying to parse and extract email data from my Gmail account using a content-script, but since Gmail uses dynamically generated DOM paths the script fails on reload as the path changes. Here is ...
1
vote
0
answers
205
views
How and in what way do content scripts share content scoped variables across different web pages?
There are some key parts of the MDN content script documentation I am having trouble understanding regarding variable scope:
There is only one global scope per frame, per extension. This means that ...
3
votes
0
answers
16k
views
Unchecked lastError value: Error: Promised response from onMessage listener went out of scope
The addon code was working perfectly fine and now I get error - ““Unchecked lastError value: Error: Promised response from onMessage listener went out of scope”” .
content-script code:
chrome....
4
votes
1
answer
1k
views
When to disconnect MutationObserver in Chrome / Web Extension?
I want to know when or if I need to disconnect a MutationObserver in my content script to avoid memory leaks.
So my content script checks all new additions to the DOM and updates the HTML accordingly....
0
votes
0
answers
210
views
Read the storage from content script
For some reason the log message is never fired from this content script (test.js):
var myData = await browser.storage.local.get();
console.log("ok");
It seems that it stuck for some reason with ...
1
vote
0
answers
206
views
Sending a message to the content script on closing a Firefox sidebar
Because our sidebar Web extension modifies the HTML content displayed in the Web browser, we would want to clear the page back once we close the sidebar.
Therefore I tried this:
sidebar.js
(...)
...
1
vote
0
answers
98
views
Is there a safe way for a web extension to have ui inside tab?
browser web extension can provide ui to interact with the user such as (sidebars sidebar_action), or little icons that allow a popup upon click browser_action).
I however would like my extension to ...
0
votes
1
answer
1k
views
Open options page from content-script on button click?
I am trying to open my web-extension options page from an injected button via a content-script onto a page. Here is the setup:
manifest setting:
"options_ui": {
"page": "options/options.html",
...
3
votes
1
answer
1k
views
WebExtension message from popup script to content script
I am new to Firefox extensions. I am trying to send a message from the popup script to the content script when a button is clicked, but I receive this error:
Could not establish connection. Receiving ...
1
vote
1
answer
2k
views
Web Extension - Content Security Policy Error when Iframe Source Executes Script
I have a firefox web extension that uses a content script to inject HTML into a webpage when a button is clicked. The HTML that is injected consists of an iFrame nested within several divs.
Here's ...
2
votes
1
answer
1k
views
Firefox/Chrome Web Extension - Security Error When Trying To Inject IFrame Through Content Script
I have the following really simple code in a content script that runs whenever a button in my "popup.html" file is pressed:
Section of code inside "inject.js"
browser.runtime.onMessage.addListener((...
0
votes
2
answers
408
views
Can't execute content script functions of an extension in the Firefox Quantum console
I'm developing a WebExtension compatible with chrome and FF, but in firefox I'm not able to see the variables or functions of the content scripts in the console.
In chrome you can change the scope of ...
3
votes
0
answers
209
views
How do I import dependencies in a WebExtension?
I'm try to develop a web extension and I figured that importing dependencies would be no different to any other javascript project. For example I'm using a package called languagedetect which install ...
1
vote
1
answer
2k
views
How to get a content script to click the LIKE button of a YouTube video?
I'm learning how to make Web Extensions and thought it would be fun to start by doing an extensions that likes a YouTube video.
My manifest portion to interact with YouTube is as follows:
"...
0
votes
1
answer
48
views
Firefox WebExtensions: dyamically decide when contents scripts are run automatically
One option for running a content script is to match one or more URLs to run it automatically. From the web site:
"content_scripts": [
{
"matches": ["*://*.mozilla.org/*"],
"js": ["...
2
votes
1
answer
4k
views
Error: Not allowed to define cross-origin object as property on [Object] or [Array] XrayWrapper
How can I avoid the following error and why do I get it?
Edit: Maybe I have to ask how I can make objects from a privileged scope visible to a less privileged scope.
My goal is to export/return ...
0
votes
1
answer
886
views
Listen in Content Script for when AJAX response changes textarea val
I'm writing a WebExtension for a text editor. When the user clicks a button, format the editor fires an ajax request and then returns the formatted text. I need my addon to listen for a change in the ...
2
votes
2
answers
2k
views
Dynamically modify content_scripts.matches in FireFox extension
So I'm trying to follow the instructions for a firefox extension using WebExtensions and I want to attach a content script to certain pages (as discussed here: https://developer.mozilla.org/en-US/Add-...
3
votes
1
answer
771
views
XMLHttpRequest Status 0 for Firefox 49.0.2 Add On
There is a XMLHttpRequest in the content script of my Firefox WebExtensions add on. Q: why is the status of this request is always 0?
This is the JavaScript code making the request:
var query = "...
4
votes
2
answers
2k
views
How can I make a firefox add-on contentscript inject and run a script before other page scripts?
I'm working on a Browser extension/add-on. We have it working in Chrome, so I'm trying to get it working in Firefox.
I've gotten my add-on to load in Firefox Developer Edition 49.0a2 (2016-07-25).
...
1
vote
2
answers
310
views
How to see or debug chrome content script in firefox nightly (webextensions)
Trying to port a working chrome extension to Firefox Nightly 46.0a1 and have a simple question! How do I get the content script to execute or see it at all?
Everything else but the content script ...
1
vote
0
answers
95
views
Extracting Files from Firefox Tabs Using Webextensions
As the title states I am attempting to extract files from a firefox tab using webextensions. Specifically PDF files or Image files. Currently I have the following basic ContentScript for web pages ...