Chrome Extension installation - javascript

I have chrome extension which get installed with using installer which install some process and browser extensions. As per chrome security changes stand alone installation will be blocked.Google to block local Chrome extensions
If we host extension on chrome store what are the ways we can redirect chrome from installer to install extension.

According to the Chromium Blog:
If your extensions are currently hosted outside the Chrome Web Store you should migrate them as soon as possible. There will be no impact to your users, who will still be able to use your extension as if nothing changed. You could keep the extensions hidden from the Web Store listings if you like. And if you have a dedicated installation flow from your own website, you can make use of the existing inline installs feature.
So, basically, what you need to do is:
Host your extension on the Chrome Web Store (optionaly keeping it hidden from the listings).
Have your installer open a Chrome browser window pointing to a webpage on your site.
On that page have all necessary info and data for the user to initiate the extention's installation process. (The key concept here is that the user has to initiate the installation process, e.g. by clicking a button.
How does inline installation work:
The HTML page on your site from which you want inline installation to occur must contain one or more tags in the section referencing the items that the user can install. Each tag must have the following format:
<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/itemID">
To actually begin inline installation, the chrome.webstore.install(url, successCallback, failureCallback) function must be called. This function can only be called in response to a user gesture, for example within a click event handler; an exception will be thrown if it is not.
(emphasis mine)
More info on the inline installs feature.

Related

Click a button in Google Chrome not using Selenium

I'm trying to install a google chrome extension on a large amount of my desktop computers using python. I've gotten Selenium to open a simulated browser with the extension, but that doesn't actually download it to the computer, so that doesn't necessarily help. My current code is
import webbrowser
webbrowser.open_new_tab(
"https://panelresearch.google.com/browser/extension/download")
This just opens the page where I can find the extension, can anyone show me a library where I can click buttons that are on this page?
Additionally, I'll need to identify the extension popup and I realized that I cannot inspect any elements in that popup.
As far as I know, there is no way of operating the extension popup using any API other than simulating the clicking on OS level.
When you're testing an extension using Selenium, you have to specify a custom profile as an argument during the start of the process connected to the WebDriver. More info here or use a special ChromeDriver API.
If you just want to force install an extension in an enterprise/educational environment, you can follow this guide.
You can also edit already existing profiles (to some extend and in my experience unreliably) by editing the Preferences file in the profile directory. Just make sure you have backups and an instance of Chrome is not running with that profile.
Good luck.

Possible to open link in Chrome Application from javascript?

From the command line, I can open a url as a chrome application by running e.g.
chromium --app=https://www.stackoverflow.com
Is it possible to do open a url in this mode from javascript in an existing page? To be clear, the url should ideally be opened in a new window, which has the properties implied by the --app flag (e.g. no address bar), whether or not the current page is running in that mode.
My reason for asking is that I'd like to integrate this into vimium.
There is no way to do what you need directly from Javascript. I think you'll need to create an Chrome extension to do that.
You still can find an extension called "Open with external application" which do that, but its use NPAPI and NPAPI is not supported anymore by latest Chrome version. The source is hosted on BitBucket.
The new way to do the same thing is using the native messaging API. In this case the external application would have to register a native messaging host in order to exchange messages with your application. You can see more at http://developer.chrome.com/extensions/messaging.html#native-messaging

How to install extension directly without visiting chrome store

I have an extension
https://chrome.google.com/webstore/detail/myextenstion/lkdklkkflkfedlbfpl
like this.
i created a menu item on my website like
Click here to Download Extesnion
which is working fine'
Now i want user just click and extension popup appear directly .
Any idea ?
Thanks
Before Chrome 33 on windows, you could self-host your crx file and serve it with a given content-type to trigger the installation popup.
See https://developer.chrome.com/extensions/hosting
Since them, to avoid malware, users can only install extensions hosted on the chrome web store (if they don't use the "developer mode" settings in chrome).
To install from a third party website directly, chrome provides a javascript API (called inline installation).
Here is the documentation
https://developer.chrome.com/webstore/inline_installation

upload chrome extension to store including native application

I have my first brand new google chrome extension, which I'd like to upload to the chrome web store. The thing is that my extension is using native messaging via stdio to a c++ exe. The extension also required a registry key to be installed.
Is it possible to upload the required files to the chrome web store (including exe and dll dependency)? Is there a way to automate the installation of the registry key (required to send messages from chrome extension js to exe), and register dll?
The idea behind chrome-extensions (and native messaging) is to limit the giant security hole that is NPAPI: to create a divide between the browser and the desktop that runs it. For this reason, you'll need to perform two separate installations: one for the extension and another for the native code.
To the best of my knowledge, you can't bundle the binary with the extension. But you might be able to (partially) do it the other way around: have the native code also install the extension:
There is a way to partially automate the process of installing the extension: you can pre-load the extension via the registry. This only applies to extensions on the chrome web-store (CWS). I believe this requires to reboot chrome. And of course the user is notified that an extension was installed. see here - https://developer.chrome.com/extensions/external_extensions
There's also something called "inline installation" - not quite "automatic", but this should make it easier for your users to install the extension from "within" your site (as opposed to the CWS). The extension still needs to be hosted on the CWS, but the user needs not navigate there.
see here - https://developer.chrome.com/webstore/inline_installation (and especially the line section - about verified site - which requires that you register your site with Google - and thus may render this technique useless to you)

InstallTrigger.install Equivalent in Chrome?

In firefox InstallTrigger.install is used to download xpi file. What is used to download the crx file in chrome browser. The download should start without the user click.
Simply change the location of your window, use window.location.href = "http://.../extension.crx";.
Edit: The answer above is outdated, Chrome no longer requires installing extensions from any website other than Chrome WebStore.
There is a supported inline installation flow that allows you to trigger installation for your extension from your website. This requires your website to be verified and associated with the extension in the Chrome Web Store. Then you can add a <link rel="chrome-webstore-item"> tag to the page pointing to your extension in Chrome Web Store and a call to chrome.webstore.install() will start installation.

Categories