Using firebase .js file in chrome extension

Using firebase .js file in chrome extension



I am developing a chrome extension that uses firebase in content script. Based on this answer I decided to store it locally in my /lib folder. Whether I download it with npm, bower or from gstatic, I always end up with binary files with chrome doesn't want to use as libraries ("Could not load file "some_filename.js" for content script. It isn't UTF-8 encoded.")



I tried converting it with iconv, Sublime, TextEdit, tried this and couple of others, nothing worked, file -I always claims that file is binary.


file -I



Is there any other way I can obtain firebase.js file, or convert the existing binary files to utf-8?





To anyone interested, the issue with converting the firebase.js to utf-8 and workaround is explained here
– mlkwrz
Sep 20 at 9:39





1 Answer
1



Actually, it is not a good idea to load the firebase bundle in a content-script.
It will slow tabs loading, even if it is taken from disk. Because it still needs time to parse and process JS code.



Good practice will be to include firebase to the background page and implement a communication using messages between background and content-script.
Setting charset to utf-8 in the background page should solve the problem.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)