webextensions-examples | Example Firefox add-ons created using the WebExtensions API | Addon library
kandi X-RAY | webextensions-examples Summary
kandi X-RAY | webextensions-examples Summary
Example Firefox add-ons created using the WebExtensions API
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Display a note display
- Listen for events on the page
- Remove data from stored time .
- Replace all text nodes with text content inside a node .
- Creates suggestions from suggestions .
- Process permission change
- Show the cookie in the list of available cookies
- Finds results in the current tab
- Detects if accessKey is supported in the browser .
- Render element descriptions
webextensions-examples Key Features
webextensions-examples Examples and Code Snippets
Community Discussions
Trending Discussions on webextensions-examples
QUESTION
Here is my background script;
...ANSWER
Answered 2021-Dec-30 at 08:00activeTab
works only when the user explicitly invokes your extension as described in the documentation for WebExtensions and Chrome extensions). Evidently, its name is highly misleading: it should have been something like activeTabWhenInvoked
.
In order to access any tab without prior interaction with your extension you'll have to add broad host permissions in manifest.json:
QUESTION
I created a temporary Firefox add-on which opens a new tab when an icon is clicked. I used the example provided in this link:
https://github.com/mdn/webextensions-examples/tree/master/open-my-page-button
This works fine but the new tab opens to a fixed URL. So added a preferences page using the code provided in this link:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Implement_a_settings_page
Now I'm able to save a URL in the preference page of the extension and the saved URL can be verified in the Extension Storage, here is an image showing it:
...ANSWER
Answered 2021-May-31 at 07:30Since you have the onGot(item)
function working. You should give your preference_url
a name to be traced from.
As you can see, when you inspect the [ Extension Storage ]. The preference_url
is stored in a key named as type.
So, you should give it a name like preferred_URL
or other name for easy tracking.
QUESTION
New to web extension development & I'm trying this example. However when I run this extension it does not trigger the listener.
This is the manifest file.
...ANSWER
Answered 2021-Mar-01 at 08:49Quoting MDN:
To intercept resources loaded by a page (such as images, scripts, or stylesheets), the extension must have the host permission for the resource as well as for the main page requesting the resource.
So, you also need to add 127.0.0.1
in manifest.json because it's not the same as localhost
, which can actually point to a different IP.
QUESTION
I am currently making an extension, and I hope I could get some practical advice on feasibility :
I want my extension to go fetch/load a local folder of custom homescreen thumbnails(top-sites), and then replace the auto-generated thumbnails in the homescreen with those it loaded. The extension would be able to read the associated domain names of the thumbnails and then replace them accordingly.
(e.g :Pinned Url : youtube.com/anything : Ok so it’s YouTube : then replace the thumbnail with “Custom_Youtube_Thumbnail.png”)
Does that seems possible to you ? (Before I dive in head first) I saw that the top-sites API is not quite available https://bugzilla.mozilla.org/show_bug.cgi?id=1246693 but maybe I’m wrong.
Extra : My extension is switching themes (like this : https://github.com/mdn/webextensions-examples/tree/master/theme-switcher ). Would it be possible to switch the thumbnails accordingly (Custom_Youtube_Thumbnail_light.png > Custom_Youtube_Thumbnail_dark.png) as i’ve made a version for each.
Would be a pleasure to hear your opinion on this, or just pointing useful resources to me, I’m not asking for a perfectly baked solution. Hope I’ve been concise.
Thanks for reading me !
...ANSWER
Answered 2020-Dec-08 at 19:01Very nice idea you had. But In short: no possible.
Main problem is that you cannot inject and manipulate on the homepage which is a built in browser tab.
"You cannot inject code into any of the browser's built-in pages, such as: about:debugging, about:addons, or the page that opens when you open a new empty tab." https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/executeScript
QUESTION
I'm writing a plugin in thunderbird using native messaging (following the ping pong example in python) to call a Delphi program to copy an e-mail locally as an ".eml" file. The problem I am facing seems to be the encoding. In addition, the resulting file contains double quotes ("") at the start and the end of the file as well as escaped double quotes (\"). I just want to have a 1 to 1 copy and not to change its content.
Example of a mail content:
...ANSWER
Answered 2020-Oct-28 at 16:11At first let me say that you did a good job in transferring data between web extension (Thunderbird add-on) and native application using native messaging. It isn't easy to understand it and set it up, but you managed to transfer required data with some tiny glitches you describe in your question.
... the resulting file contains double quotes (
"
) at the start and the end of the file as well as escaped double quotes (\"
)
In the add-on you obtain raw email data as a string - console.log(typeof raw)
gives string
which you then pass to port.postMessage
. Although the documentation says it takes JSON object representing the message to send, but it seems to accept single string value which is valid JSON according to some standards. In Delphi code you receive the message via STDIN
and parse it using TJSONObject.ParseJSONValue
into TJSONValue
. It will in fact create instance of TJSONString
. You can verify that by examining the value of jsonValue.ClassName
. The problem with quotes arises when you use jsonValue.ToString
which returns quoted version of the string that is basically the same what you had before parsing. Use the Value
property to return raw string value.
Using jsonValue.Value
alone will not help you with the encoding issue. The raw message data that you obtain from the e-mail client is in EML format. It conforms to RFC-822 and that means it is ASCII encoded, but it can contain arbitrarily encoded message parts (see your own sample EML). Since you only want to save EML file as is not taking any encoding into account, the best would be to transfer raw bytes of EML, but this isn't out-of-the-box supported by Javascript and native messaging API. Therefore I'd suggest you to send Base64-encoded data string to native application where you decode it into raw bytes that you can write straight to disk.
To encode raw message data as Base64 string in add-on use function btoa:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install webextensions-examples
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page