angular - How to use firebase auth in my own chrome extension -




i create simple chrome extension using angular. create homepage, user can login google account. easy, because used angularfire2. problem occured, when wanted use firebase in context menu of own extension: f.e:

context-menu.js

var clickedfunc = function(info, tab) {     console.log(info, tab)     alert('click'); };  var parent = chrome.contextmenus   .create(     {       "title": "check click",       "contexts": ["selection"],       "onclick": function(info, tab) {         clickedfunc(info);       }     }   ); 

these code work fine, if trying using firebase in context menu in way:

context-menu.js

var firebase = require('firebase/app');  var config = {   apikey: 'secret',   authdomain: 'secret', // know mean };  var app = firebase.initializeapp(config); var clickedfunc = function(info, tab) {     console.log(info, tab)     alert(firebase.app().name); };  var parent = chrome.contextmenus   .create(     {       "title": "check click",       "contexts": ["selection"],       "onclick": function(info, tab) {         clickedfunc(info);       }     }   ); 

chrome extension installed in browser. i can open homepage, original context menu not displaying. can me?

i added other part of other file, can generate bug:

part of manifest.json

  "background": {     "persistent": true,     "scripts": ["home.js", "context-menu.js", "firebase.js"]   },   "permissions": [     "tabs",     "contextmenus"   ],   "content_security_policy": "script-src 'self' 'unsafe-eval'; https://cdn.firebase.com https://*.firebaseio.com; object-src 'self'", 

you need download firebase.js , put in in extension, load relative url. extension isn't allowed access external scripts.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

python - Read npy file directly from S3 StreamingBody -