Is there an equivalent for firefox AddonInstall in chrome extensions? - firefox

In Firefox this code can install a new addon:
Components.utils.import("resource://gre/modules/AddonManager.jsm");
AddonManager.getInstallForURL("http://www.foo.com/test.xpi", function(aInstall) {
// aInstall is an instance of {{AMInterface("AddonInstall")}}
aInstall.install();
}, "application/x-xpinstall");
I used it for a custom updater and works very well. Now I was wondering if is there something similar for Chrome extensions?

If you look at chrome.management API - it has all kinds of extension manipulation functions with the notable exception of extension installation. This is definitely intentional, Chrome developers don't want to allow writing "custom updaters" (something that could be easily misused).
There is only a limited solution to install extensions via chrome.webstore.install() - you get the same "service" as any website. You have to add a <link> tag to your background page like this:
<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/..." />
You can call chrome.webstore.install() then and the user will be presented with a confirmation prompt. Installing extensions not present in the Web Store isn't possible, same goes for silent installations.

Related

Testing Firefox Add-on/Extension Internationalization

I have created a Firefox Add-on using jpm and I have added a number of localization files such as:
locale/da.properties
locale/en-GB.properties
locale/en-US.properties
locale/fi.properties
And so on...
In my HTML files I use attributes to set these values, for example: data-l10n-id="ext_panel_heading_text".
I know the translations are working, because changes I make to values in en-GB.properties are reflected in my add-ons HTML page.
I've tried navigating to Options > Content > Choose... (under languages), removing English and adding another language (such as Finnish), however it doesn't seem to have an affect on the .properties file loaded by my extension. I also tried restarting Firefox after changing the language.
My question is: How do I test the different languages?
The language of Firefox is dependent on the activated language pack, or for Windows and Mac I believe it is hard coded into the build.
Language packs are available from https://addons.mozilla.org/en-US/firefox/language-tools/
The only way I know is to change general.useragent.locale to the locale you want to use (en-GB, da, en-US, fi) in about:configand then restarting your browser: that way your add-on should show localized texts.
As an alternative, you can use Quick Locale Switcher, which does the same but it's a little more friendly.

Firefox command line print

Have a requirement to print html or html from vb6 application using only firefox as we have already for IE. So, need command to print using firefox.exe.
Something like this firefox.exe -print http://www.google.com which is not working. Is there anyway to do this? Thanks for your help.
There is no built-in support for a -print command line switch. See this document for the different command line switches supported for the Firefox browser. Support for such functionality would most probably have to be implemented through an extension.
If no extension exists that currently offers what your looking for, a Google search yielded this mozillaZine forum thread: "Printing to file from Commandline?" You could have a look at the discussion, or download and modify the referenced add-on from the source link.
Or else, you could always create your own application (probably not in VB6) by embedding the Gecko layout, but since the Mozilla killed the embedding API a while back, you'll have a lot of integration work to do (or else you could go with another layout engine like Webkit).
You can use the built in webbrowser control to print html via IE: http://www.vbforums.com/showthread.php?384076-Webbrowser-Control-Tip-and-Examples
If you must use firefox, there was a firefox active x control but I have not used it and dont know the status:
mozilla firefox activeX
or
http://www.iol.ie/~locka/mozilla/control.htm
or
https://bitbucket.org/geckofx
It also looks like there is a webkit floating around online (google it)

How to create a ui button for SeaMonkey

I'm trying to get my extension (using Firefox Addon SDK 1.17) to work on SeaMonkey (2.30). After modifying install.rdf to allow my extension to be installed, I can see SeaMonkey accepted the extension. However -- my extension's button isn't visible anywhere in the UI. I am using sdk/ui/button/toggle. I have also tried require("sdk/ui").ActionButton but that doesn't seem to do anything either.
What do I need to do to make sure my extension can render a button into SeaMonkey's toolbar?
Looks like the answer is that SeaMonkey does not officially support the Addon SDK yet. Support is planned for SeaMonkey 2.33
There are a couple of options:
patch the sdk to allow support on seamonkey.
copy the button code from the sdk into your add-on, mark it as supporting seamonkey, and use that, possibly uploading the code to npm as a third party module.

Can you use the "Inline Install" feature for Google Apps Marketplace listings?

I have an app in the Google Apps Marketplace via the Chorme Web Store.
On the Edit Listing page is an option for Inline Install.
I have followed the instructions, but when I click the link, I get an error in the console "Uncaught Chrome Web Store installations can only be initated by a user gesture.".
This is misleading, as it is triggered by a user gesture.
I have tried various different things such as providing the URL as the first argument to the install method, and have stepped through the code. Everything looks okay my end - I am now thinking that maybe this feature is not compatible with Google Apps Marketplace listings?
For clarity, here is my code:
Link
<link rel="chrome-webstore-item"
href="https://chrome.google.com/webstore/detail/[listingId]">
Javascript:
document.getElementById('btnTestInline').addEventListener('click', function() {
chrome.webstore.install();
});
HTML:
<button id="btnTestInline">Add to Chrome</button>
No, you can't. Also Google are removing the inline installation also any kind of apps and extensions.
As of 06/12/2018, inline installation is deprecated.
https://developer.chrome.com/webstore/inline_installation

Chrome/Firefox: access source of an extension

Do Chrome or Firefox make your extension's source code open to the host machine? And if yes where are the respective folder on Mac?
Yes, assuming some or all of your extension is written in an interpreted and un-obfuscated language. Plain Javascript is common for extensions in both browsers.
For any firefox extension, if you save the .xpi file instead of installing it, it is just a zip file and you can open it with any archive tool (e.g. 7zip or WinZip).
The same goes for the .crx files Chrome. As an test, I just downloaded and opened the .crx for Google Mail Checker Plus using 7zip, and it looks like this is entirely written in javascript and all the source can be read.
In either case, how much usable source code you can get from this depends on the language(s) that are used in the extension.
Google Chrome installs the extension into ~/Library/Application Support/Google/Chrome/Default/Extensions/<EXTENSION_ID>/ and registers it in its Preferences file (according to this).
As heb says, Firefox installs the extension to ~/Library/Application Support/Firefox/Profiles/PROFILE_ID/extensions/EXTENSION_ID/
For Firefox the path is:
/Users/YOUR_LOGIN/Library/Application Support/Firefox/Profiles/PROFILE_ID/extensions/EXTENSION_ID/
view online
View a Chrome/Firefox/Opera extension/addon’s source in browser (without downloading):
https://robwu.nl/crxviewer/
bookmarklets
bookmarklets usage
Click the bookmarklet when on an extension’s page in the Chrome Web Store, Firefox addon gallery or Opera addon gallery.
bookmarklets source code
load in same tab
javascript:location.href='https://robwu.nl/crxviewer/?crx='+location.href;
open in new tab
javascript:window.open('https://robwu.nl/crxviewer/?crx='+location.href,'_blank');
bookmarklets links
view extension source online (Chrome .crx) # https://robwu.nl/crxviewer/?crx= ← You can drag this link to your bookmark bar to create the bookmarklet, but you have to edit its URL afterwards: Delete everything before javascript, including the single slash: http://delete_me/
view extension source online in new tab (Chrome .crx) # https://robwu.nl/crxviewer/?crx=
I know it's an old topic but for future research.. it could be interesting..so following the link :
How to find extension code?
This article explains very well where are located extensions code for Firefox, Chrome (working on Chromium too of course) on Ubuntu and Windows!
Best,

Resources