Is there a IONIC Chrome APP or Chrome extension?


#1

I’m doing a Chrome app based on IONIC. I’m curious if someone here did a Chrome APP or Extension with IONIC?

There’s somes special setting to make it work for Chrome APP and i did find all setting i need to make it work.

/* GC - FOR CHROME APP - WE NEED TO DISABLE HISTORY PUSH */
.config(['$provide', function ($provide) {

        $provide.decorator('$window', function ($delegate) {
            Object.defineProperty($delegate, 'history', {
                get: () => null
            });
            return $delegate;
        });

}])
    /************************************/

We need to allow some permissions:

.config(['$compileProvider', function ($compileProvider) {

        $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|file|content|blob|cdvfile|local|data|chrome-extension)|data:image\/|\/?img\//);
        $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|ghttps?|ms-appx|chrome-extension)|\/?app\//);

}])

I wanted the Android platform for Chrome only. i Added a class to make special css for Chrome only.

.config(function ($stateProvider, $urlRouterProvider, $ionicConfigProvider) {

/* GC - CHROME - IF IS CHROME ADD CLASS platform-chrome TO BODY SET PLATFORM ANDROID */
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;

if (is_chrome) {
    angular.element(document.getElementsByTagName("body")).addClass("platform-chrome")
    ionic.Platform.setPlatform("android");
}
});

CSS exemple only for Chrome:

.platform-chrome #menuPopover {
    top: 79px !important;
}