angularjslearner66
angularjslearner66

Reputation: 131

Can I embed a chrome extension app as part of my main AngularJS app?

I have been doing a lot of reading and studying to figure out.

I basically just want my main AngularJS application to run, but also include an embedded Chrome Extension app - in this case, have regularly scheduled alarms (using the chrome.alarm API).

I want all users of my AngularJS app to have automatic access to the Chrome extension app, embedded in the main clientside one with lots of other Angular features.

It seems like I have to manually enable my Chrome app in Developer mode on my browser and even drag my Chrome app specifically to a location in my Chrome browser. I don't understand how end users can just automatically use my Chrome app then.

I need to add here I have never really used jQuery, only AngularJS but AngularJS extensively. My AngularJS app is the frontend, the backend is provided by Rails.

Some advice would be really helpful. I hope I am not downvoted as it is strange how sometimes questions get downvoted and I am not sure why...I don't really know where else to go with this question.

EDIT:

Ok some code to demonstrate:

myangularapp.controller('myappcontroller', function($scope, $http) {

var delayvar = 5;

 chrome.alarms.create("arandomalarm", {delay: delayvar});


};

This doesn't just work as part of my AngularJS, I tried creating a manifest.json file in the app/assets folder too. As well as a background.js file there and my-chrome-app.js file. "chrome.alarms" is undefined, but I haven't enabled Developer mode yet. But still, how are end users supposed to use it if just to make me use it I need to do so much specific browser configuration?

Upvotes: 1

Views: 1654

Answers (2)

Zig Mandel
Zig Mandel

Reputation: 19835

its not possible to automatically install a chrome extension. the user must install it from the chrome store.

you may make it easier for them to install it by providing an inline installation from your webpage. its in the official documentation and you can see an example on this page with the "add to chrome" button:

http://plusfortrello.com (one of my chrome extensions which has inline installation inside that page).

that example button is further customized to display a message instead if the user is not on chrome desktop.

if your extension also has permission to your webpage then you can also detect from your webpage if the extension is already install it (to hide the button, send messages to it and such).

Upvotes: 1

Ivan Gabriele
Ivan Gabriele

Reputation: 6900

You should have a look at Content Scripts and then at Message Passing which explains you how to communicate between a web page and an Chrome extension.

Upvotes: 2

Related Questions