How to test published Chrome Extension - google-chrome

When I develop a Chrome Extension locally, its icon is in the browser action bar. When I install a published version of my extension, there are now two of the same icons in the browser action bar. Sometimes I can't remember which is which.
If I open an incognito browser tab, I can't seem to load any extensions. But what I want to do is test my published extension in a sandbox, where I know I have the latest version.
What is the best way to test a published extension on the same machine where you develop the extension?

One way would be to create a new profile in Chrome to test your local extension.
You can also drag and drop the browser action items, so you could move the development extension all the way to the left and the published one all the way to the right.

I currently have installed 4 versions of a Chrome extension I'm developing:
One loaded from the unpacked source files, for debugging
One loaded from the minified code in a build directory, for testing how speedy it feels in day-to-day use
The published version installed from the webstore
A completely separate test version installed from the webstore
As Matt suggests, I've rearranged the icons on the Chrome toolbar, putting the minified version on the left, then the source version, then the ones from the webstore.
But this can still be a bit confusing, so I've also changed the build process a bit. The manifest.json now sets both the name and browser_action.default_title fields to "My Extension DEV". This string is shown in the tooltip of the version I've loaded from the source directory.
During the minification process, I have the build script change these values to "My Extension OUT (build time)", so I can see when the minified version was last built in the tooltip.
The script that actually packages the minified files into a .zip file for upload to the webstore then resets these values to what the published extension should show.
You could also change these strings at runtime instead of as part of the build process. If you have a background page, it could call chrome.management.getSelf() and then check the response's installType key. If it's "development", then you could call chrome.browserAction.setTitle("DEV") to indicate in the tooltip that it's the unpacked version of the extension.

Related

google-chrome: making the start page be an extension (not an app)?

Is there any way to start up the google-chrome browser so that an extension (not an app) gets launched as its start page?
I know I can do the following, but it only works if app-id refers to an installed app, not an installed extension ...
chrome --app-id=XXXXXXXXXXXXXXXXXXXXX
If the specified app-id is the ID of an installed extension (not an app), then chrome doesn't launch it.
Is it even possible to launch an extension as chrome's start page?
Thank you in advance.
CORRECTION: I am referring to the start page, and I have clarified the wording of this question accordingly.
I figured out how to do it, with the help of wOxxOm ...
chrome chome-extension://XXXXXXXXXXXXXXXXXXXXX/index.html
This works for all extensions that have some sort of HTML page for their startup. For the extension I'm dealing with, this is index.html, but different extensions might have different HTML startup pages.
I see now that the URL with the reference to the HTML file is simply the extension ID followed by a slash, followied by the HTML file name. I was previously trying it incorrectly with the extension's version number as part of the path.
And to be clear, some extensions do not have HTML startup pages, and they therefore cannot be invoked in this manner.

Improved Add To Homescreen (WebAPK) icon & name for installed web app on Google Chrome not upgrading after manifest update

I have a website that meets all the pre-requisites for Google Chrome for Android's "improved" add-to-homescreen (A2HS) feature. I can install the app and a APK is formed and gets installed on the device and icon is available on homescreen.
In the Google developer blog documentation, it is said that with the "Improved" A2HS now, it's possible to modify the manifest.json file with new icon and name after the site is visited subsequently, the installed web app's icon and name should upgrade:
You now have the ability to update your Progressive Web App's icon and
name and have it reflected to the user. Changing your icon or name in
the manifest will update the icon on the home screen after the user
has subsequently opened the site.
I have tried to modify the manifest with new values and verified that the modified manifest is being downloaded to the browser when the site is opened again, but the update of the name and icon for the installed web app does not happen. This is tested on Chrome for Android v63.
How do I get it working? Are there any particular steps that need to be taken care of? Am I missing something?
According to what I read, if you are able to create a WebAPK from your website, then you're all set for improved A2HS.
I've tried changing my shortname in my manifest.json to see if the app name updates, but to no avail. So I assume that this isn't something we could control, since we fit all the requirements of improved A2HS.
I do not know how long Chrome needs to generate a new APK for our pages, nor do I know when exactly it does this as I'm not patient enough to wait too long(I've waited for about an hour), so do take my word with a grain of salt.

Disable update of specific chrome extension

With recent news of adblock being sold to some unknown company, first thing i want to do is disable any possible update for that extension.
I've found number of questions but they are outdated. So chrome pros please tell how do we disable a specific plugin? and please take into consideration that there are many instances which synchronize it is important that the change gets synchronized to other computers, if it is not how do we do that?.
And a secondary question : where do we find sources of already installed extension? so that we could later pack and run it?
Chrome does not offer a way of disabling an update for a specific extension.
If you want to make sure that you run some specific version of an extension, you could try any of the following options:
Read-only extension folder
Go to the directory containing the extension, and mark the directory as read-only. To find that directory, visit chrome://version and look at the path at "Profile Path". The extension will then be at [value of Profile path]/Extensions/[32-character extension id].
Download the source code
Download the source code of the extension, and load it as an unpacked extension (or upload it to the Chrome Web store, and then install it).
There are several ways to get the source code (including just copying it from the directory as I mentioned at the previous step).
If you want to download a Chrome extension without installing it (e.g. because the new version contains unwanted "features" that you want to remove), then you could use my Chrome extension source viewer to download the code.
Some extensions expect to be run with a specific extension ID. You can forge this extension ID if you load the extension in unpacked mode (but you cannot upload the extension to the CWS if you do that). For instructions on fixing the extension ID, see How to change chrome packaged app id Or Why do we need key field in the manifest.json?.

Make a NPAPI plugin(made for firefox) run into chrome browser

I have a NPAPI plugin , running fine in firefox. Now i want to port it to chrome browser, means i want it to work in chrome also.
But i have learnt after browsing on internet and many links that chrome no longer supports NPAPI rather now it supports pepper API and now there is concept of native client.
What i have developed an understanding so far is that if i replace the NPAPI code(made for plugin for firefox) with the Pepper API code and upon compilation, a pexe file(native client module) along with manifest file(which is referring to the location of the pexe file) would be generated which would be kept on the server.
when an html page having embed tag describing a particular MIME type, say "application/x-pnacl" is loaded, then via src attribute(referring to the manifest file) of embed tag, manifest file is fetched which then fetches the actual pexe file which is then run by/within the native client plugin(already present in chrome).
I am not sure whether this understanding is correct or not. I was assuming that just like firefox plugin, pexe file would be stored and installed on local user PC and then detected/loaded by chrome as a plugin. Please tell whether this is correct or not.
Also, I want to ask whether still there exist any way to run NPAPI plugin in chrome or not. If it is please tell otherwise i should not think about it.
First, Chrome no longer supports NPAPI plugins for security reasons:
https://support.google.com/chrome/answer/6213033?hl=en
Plugins must use the Pepper Plugin API (PPAPI) and be compiled as Native Client (NaCl) executables so the plugin binary can be validated as safe to run. Portable Native Client (PNaCl) plugins can be loaded by any web page without the user installing anything. However, if your plugin is large, you may want to distribute it as a Web Application through the Chrome Web Store. In that case, you can bundle your .nexe's or a .pexe with your application so it is effectively installed on the user's machine.
This link describes how you can distribute your plugin:
https://developer.chrome.com/native-client/devguide/distributing

Is it possible to have a customizable Chrome (or Chromium) installation file?

I added two extensions to my google chrome that I want to send to some extern users, which are not "technical" people (I mean that they don't have IT skills). Instead of showing them how they can download and add an extension to their google chrome, I want to simplify this task by sending them an installation file of chrome (or chromium) which already contains these two extensions. So, in this case, the only thing that they have to do is just to do a normal installation (with the .exe file since they use only windows) like there are installing a normal google chrome! After that, they will have a chrome which already includes these two extensions.
Can you tall me how can I do that? because I have no idea of it..
Thank you!!
Chrome has instruction for doing this here: https://developer.chrome.com/extensions/external_extensions. You should be able to do it via a registry addition.
Note, as of Chrome 33, you will need to publish the extension to the store, and you just add update urls. Chrome does not allow installation otherwise for security reasons.