browser plug-in or extension, which to choose? - javascript

I intend to modify the display of existing websites.
For example, when Google returns search results, can I customize the web page displaying (such as adding some bubble visualizations onto that page's blank places) ? Could it be done using browser plug-in or extension?
Based on my knowledge, a browser extension, such as firefox or chrome extension, is usually for adding tiny icons to the address bar.

Could it be done using browser plug-in or extension?
Yes. But you don't want to write a browser plug-in. They're fairly complicated to write and users are reticent to install them (with good reason) Further, you'd have to write two, as Mozilla and Google can't agree on a format (Chrome is removing the venerable NPAPI, but Mozilla won't implement Google's PPAPI, claiming that it's a moving target with inadequate documentation).
Based on my knowledge, a browser extension, such as firefox or chrome extension, is usually for adding tiny icons to the address bar.
No. Firefox add-ins and Chrome extensions can do a lot more than that, including modifying the page once it's rendered.
So you'll probably want to write a Firefox add-in and a Chrome extension. (Sadly, yes, that's two codebases to maintain, although they use similar technologies — HTML, CSS, JavaScript — so you can share a bit between them.)

Related

Can firefox's multi-account containers extension be replicated in chrome or chromium based browsers?

I love the firefox extension multi-account containers. I want to switch to brave browser but I can't find a good alternative. Is it a functionality that can only work in firefox due to API limitations or is it possible to implement it in chromium based browsers via an extension?
If I want to create this extension can I make it exactly the same as firefox's multi-account containers? I tried to load the extension into brave but it has many errors due to the differences in the APIs I think. So the only way to do this would be to program it for chromium. Is that possible?
I found this reddit thread https://www.reddit.com/r/brave_browser/comments/kw2cff/brave_alternative_to_firefoxs_multiaccount/ it appears to suggest that containers are firefox exclusive and sessionbox is an alternative suggested. I tried sessionbox though it appears to be limited to having to click on the extension and then select a session to start the website in while multi-account containers can do that automatically if you set it to always open in container.
Are there extension API features that such an extension makes use of and chromium based browsers don't have?
Maybe this feature can be implemented not through an extension but directly through the browser, as brave is open source it should be possible for me to add this feature or fork it and add it there.
[this question is a duplicate of another question I asked; an attempt to make it more clear; I removed the other question]
Multi-account containers functionality requires Contextual identities browser extension API and which is only supported in FireFox.
As for 2023, it's not possible to implement FF's multi-containers in Brave/Chrome.
But you can spread the word and vote for this feature here:
https://community.brave.com/t/equivalent-of-multi-account-containers-or-temporary-containers-extension-ff/135573
It's not a lost cause but this feature has been discussed by Brave's team since their launch, about 5 years ago:
https://github.com/brave/brave-browser/issues/34
Their conclusion is that is too much work. They say this feature has to be implemented by Chrome first, otherwise they have to patch too many things.
The problem is that Google won't ever implement something like that in Chrome, IMO. The whole idea goes against their core business: track users for targeted advertisement.
There are some plugins you can give a try, but they are not practical (in my opinion). Also, I wouldn't trust a plugin to access all my browser data (history, cookies, etc).

Add context menu in bookmark menu

I am trying to add a context menu item in the bookmark menu of Firefox (with a WebExtension). I read the contextMenus.create() article and the example works for me.
There are a bunch of context types, but none seems to work in the bookmark menu. Is this not possible?
What you desire is not currently possible in a WebExtension. In general, if there is capability that you desire in WebExtensions which does not already exist, you can:
File a Request For Enhancement (a bug) requesting the functionality. In the case of adding an item to the bookmark context menu, such a bug already exists: Bug 1370499: Consider support for bookmark context menus. The general direction from this tracking bug is that adding an entry to the bookmark context menu will be implemented at some point in time.
Create a WebExtension experiment: You can create a WebExtension experiment to implement the functionality. If you create a WebExtension experiment, you can request that it be integrated into Firefox (which may, or may not happen). Having a WebExtension experiment will make it more likely that something along the lines of what you want is implemented, because it reduces the amount of Mozilla developer time required to do so. As WebExtension Experiments are actually legacy add-ons, they will not be able to function in Firefox as of the Release version of Firefox 57 (2017-11-14).
WebExtension experiments support (and legacy add-ons in general) is disabled by default in Firefox Nightly. However, in Nightly, you can enable an about:config preference, extensions.legacy.enabled, which allows you to use legacy extensions, including WebExtension Experiments. This is expected to be also be true in Developer Edition, but has not been verified. WebExtension Experiments and legacy add-ons certainly won't function in the Release version of Firefox 57.
One thing that might improve the chance of having some functionality added to Firefox is to look through what is possible in Chrome extensions. If there is a Chrome extension API which closely matches what you desire, then it's more likely that Mozilla will implement it.
Unfortunately, there is a huge amount of functionality available in the other types of extensions which is not possible in WebExtensions (at least currently, and almost all of it permanently), but it's possible that any specific functionality could implemented. Some things not initially supported have been implemented, at least to a limited extent (e.g. Sidebars).

Ctrl + C / Ctrl + V in Google Sheets - how does it work? [duplicate]

There are multiple similar questions in stackoverflow which deal with how to Cut, Copy, and Paste from JavaScript (in response to a button press, for instance) without the user having to use CTRL+X, C, or V.
All these answers suggest either that you are insane for wanting to do this and that users should never have their clipboards violated in such a profane manner, or to use the hack of an invisible Flash movie (which has questionable support).
However, Google Docs does this, and does not use a Flash movie. You can open a Google Document, Go to the Edit menu, choose "Paste" (or Cut or Copy) and NOT get a browser window that tells you "Your browser security settings don't permit the editor to automatically execute copying operations."
However, go to another rich text editor (CKEditor or TinyMCE for instance, but this is common among them all) and try that same command. You will get a message that reads:
"Your browser security settings don't permit the editor to automatically execute copying operations."
So the question is simply: What is Google Docs doing to allow users to Cut, Copy, and Paste via a menu button that doesn't run in to security issues?
A quick look at all my browsers show that I have a Google Docs extension installed. I know for a fact it is possible to do with the use of an extension (Browser extensions play in a different, more "trusted" sandbox), which you could (and people do) use these to expose an API to javascript used within their sites within the browser in which the extension is installed.
Based on the fact that I definitely have extensions from google to allow "for the viewing and editing of google docs" across all my browsers - this is how they do it. Building extensions for browsers is a per-browser project and the code you write for an extension in one browser is typically only partially portable.
Google does it because its user base intrinsically trust it and so they happily download and install the necessary extensions and plugins Google publishes for varying web-based services that extend beyond the capacity of standard web technologies. We trust that Google won't get our stuff pwned.
So the short answer is: You can't do it. Unless you're prepared to write the necessary extensions/plugins for Chrome, Firefox, Safari, IE8+... etc... Google works because of an extension called Google Docs installed within your browser. (IE, in Google Chrome navigate to chrome://extensions/ to see your own google docs extension).
If you want to give extension writing a try for Chrome, visit their guide on how to do so! Be forewarned however, that installing extensions takes significant trust on a user's part and should not be required early in any "sales funnel."
Edits: Because I'm horrible at grammatically correct English

Is there a way to port a chrome extension to other browsers?

Is there a way to port a chrome extension to other browsers, without having to entirely re-write the code? My chrome extension uses the browser_action command to open "popup.html" in the extension window...
Update: I found adblockforchrome port.js and found it only somewhat helpful for porting to Safari...
Apple provides some guidance on how to port convert a Chrome extension to Safari, but the problem you're going to run into is that each browser has a different set of allowed functionality for extensions. Even with Chrome to Safari, there are things you could do in Chrome you can't do in Safari, and visa versa.
It depends on the type of the extension, but not really. To answer your question more clearly, you need to specify what your extension is about: modify some pages (like userscripts/userstyles), extend browsers' features, or something else.
There are a few portability notes, however, that could help you to simplify this process:
Don't write browser specific code. In some modern browsers you're able to use HTML5 features, like Web SQL Database API. It is difficult to emulate such behaviour on IE, for instance.
Keep your JavaScript modular; don't use vendor specific JavaScript methods, and your code will be portable and will not rely on TraceMonkey or V8;
Separate HTML from CSS and Javascript, don't make your code dirty and complicated.
Jumping in a bit late.
Our company - Slice Factory (full disclosure here!) does provide a browser extension conversion service: http://gallery.extensionfactory.com/labs/conversion/
In most cases your chrome extension will work seamlessly in FF and Safari.
The service is still in beta trial, and Firefox conversion is working better than Safari one.
I can't fully disclose what's our technical solution, but this being an SO answer, I can add a few details: we have re-developed a full javascript api stack that mimics most of chrome extension APIs for Safari and Firefox; in Firefox we base our work on JetChrome. Plus we have wrappers that re-package the chrome extension adding our library and rewriting manifests and so on.
Beyond that, it's mostly a few good ideas, trial and error, and a LOT of development time.
As an example:
Safari 5.1 just introduced a popup corresponding to Chrome's browser_action, but we have already an alternative solution that works for previous versions. Firefox does not support HTML5 WebSQL, but we have an API for it. We also provide a way to bring webapps to FF, and soon to Safari.
The objective is to have Chrome API as a reference, and mimic it on all the other browsers.
Without pushing you towards our solution, I might add that the time to fully cover the Chrome API on both Safari and Firefox is probably not worth it - unless you plan to convert several extensions. So for just one or two extensions I would advise making your code as modular as possible, and just creating three extensions - or trying our service!
Yes, it's possible with Webextension API using webextension-polyfill.
I made use of it to build this where I only had to change the callback methods to Promises and using browser.something instead of chrome.something to call the browser APIs.

Mozilla Firefox programmatic screen capture

I'm interested in writing javascript that will programmatically perform a screen capture of what is viewed in the browser, and save the file to the hard disk. I'd like to be able to type in a list of keywords, and use a search engine's api to programmatically view the page, and take a screen capture.
My first question is, does this sounds like something that would violate the terms of my browser, Firefox, or any or all search engine api's? All of my web development experience is Internet Explorer. I'm aware of the various free and open source applications available, but am not familiar with their licenses.
Is this something that could be done using javascript? I've noticed that there are screen capture add-ons available to install. Is it possible to execute an add-on programmaticaly through javascript?
Is their a Firefox / Mozilla equivalent to an ActiveX control?
Any information would be greatly appreciated.
Thanks
You can use flash/Active X to do it. Check out Kpoint.in, It records the entire desktop from within the browser(Works only for Windows though). I think they are using their own Firefox extension for the Audio.

Categories

Resources