I am using native messaging API in Chrome extension, and I want to ship the native application within my extension.
In Windows, I add a registry key under HKLM\SOFTWARE\Google\Chrome\NativeMessagingHosts. Since my application is inside the extension folder after installed, I reference the full path by "%LOCALAPPDATA%\Google\Chrome\User Data\Default\Extensions\...\....json". But in this way, my extension complains "Specified native messaging host not found.".
If I expand the %LOCALAPPDATA% and write the path as "C:\Users\...\AppData\Local\Google\Chrome\User Data\Default\Extensions\...\....json", then my extension can successfully communicate with the host.
I wonder if this is an intended behavior? Thank you for your help.
There is no expansion of environment variables in the current Chromium code. It sounds like a reasonable feature request, though there might be security reasons not to do it. If you file a bug, we'll have a look and see whether it's feasible.
Related
I'm making an app that requires access to the tabs the user has open at the time. I haven't found a way to access this information without deploying my app using Chrome itself.
However, making an extension limits the UI severely (and my app requires a nice, organized UI). However, I understand Chrome apps are about to be discontinues. What other alternative do I have?
Chrome offers extensions as a way to gain access to the internals of the Chrome browser. As mentioned, apps are being discontinued. You can no longer publish new apps which are not specifically for Chrome OS. There are no other API alternatives to gain direct access to the internals of Chrome.
As with any program that is running on a multiprocess operating system or windowing system, your application can use OS and windowing system specific methodologies to snoop on other processes/windows. How to do that is OS/windowing system specific and is way beyond a single Stack Overflow question/answer. However, there is an alternative available that is specifically intended for the case which you describe.
Use Native Messaging
For what you want: Access to internal Chrome information (e.g. the open tabs) while maintaining full control of your user interface (to the extent available in your OS of choice), the documented methodology available to you is to use Native Messaging. You will need to create a Chrome extension to provide access to Chrome internal information. You can communicate that information to the OS native application, which you also create, using the native messaging API. As with most such APIs, it is just a communications channel. You will need to create a message format/protocol which covers your needs.
Hello I would like to use networkingPrivate api, which one is from chrome private API, I have added permission for networkingPrivate but it seems that is not enough. Also I found this
These are only usable by extensions bundled with Chrome, they are not publicly accessible.
here: https://developer.chrome.com/extensions/private_apis, but I'm not sure what that exactly mean, and how to do that.
My original intention is to get info about wifi (ssid,...)?
Thanks
It would be a security risk to allow user extensions to access this information direct from the OS. I think the private API is for Chrome OS, so that you can access and modify OS features direct from the browser, since Chrome OS is basically just a browser.
You could try looking at Native Messaging, which I believe will allow you to connect your extension to a native application installed on the host's machine. The application written by you would have some link between the extension, and then you can pass messages between the two. For example, your extension could request network information, and the native app will get that and send this information back to the extension.
I haven't looked into this so I may be wrong, but worth investigating. I'd be very interested to see the result.
Private APIs are made for internally usage.
For example, DeveloperPrivate API is used on chrome://extensions page.
They have stronger power than other APIs. but they also have security issues if they are open. if you really need to use them, just ask to make new API.
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
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)
My requirement is to launch my installed application from chrome browser if it is installed on client machine, If not installed then I wanted to start download. What is best recommended solution for chrome?
So fare i tried following
used NPAPI, but due to deprecation of NPAPI by chrome I can't use.
Checked PNacl and Pepper API both API not providing access to local file system to launch an application. They just port my C/C++ code in browser and run it in browser environment with sandbox restrictions.
Is it true only option i have is to use native messaging? Or is there any other option for simple task to launch my application from our url,
Regarding “Native Messaging”
Do users need to install my extension
Do i need to add my extension to chrome store
How to deal with Registry permissions for non admin users
Can i install extension to chrome along with my app installation
Note :- Found some providers use “External Protocol Request” to launch application but there are no enough resources where can i found more about this
Thanks and Regards,
Pravin
For what its worth,
see here - http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/nativeMessaging/
the README indicates that Native Messaging can now be added even by non-Admins.
But it appears Native Messaging will only work for Extensions: "Extensions can exchange messages with native applications(...)" and I dont imagine you can expect all of your users to do that.
To open it if it's installed you just need to register your application (at the OS level, so the details will vary by OS; you don't say what OS you are targeting) as a handler for some specific scheme, then have your page open that scheme. That's the same flow that causes mailto: links to open a user's mail client, for instance.
If you have a chrome app, you can use inline install: https://developer.chrome.com/webstore/inline_installation