How to load/build Chrome App/Extension and run programmatically

南楼画角 提交于 2021-02-11 07:44:26

问题


I'm looking to make a Chrome App similar to Google's own Chrome Dev Editor, an application built using web standards to create Chrome Apps/Extensions

In Chrome Dev Editor, it's possible to run the Chrome apps/extensions you create right within the app itself. It builds the apps and executes them.

Is there a specific API to do this for the app I want to make? If so what is it and where is the documentation for it?

Any guidance on this subject would be appreciated.

Thank you! -Rick


回答1:


Chrome Dev Editor is whitelisted for the chrome.developerPrivate api. You cannot deploy an app with this capability to the webstore.

Fortunately, you can use this api by loading as an unpacked extension, adding the "developerPrivate" and "management" permissions, and setting the key manifest property to one of those whitelisted keys.

If your users are Chrome app/extension developers, they will be familiar with loading unpacked extensions, so you could ask them to do it themselves to access these features and distribute a version without those features to the webstore.

You can include an option to export the source and automatically insert a manifest key using chrome.runtime.getPackageDirectoryEntry(), and checking if chrome.developerPrivate is defined before using it in your code.

whitelisted keys:

  • Chrome Dev Editor: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2OvldPjAqgEboHyyZM7GpCMmGMSQ8aExOlQyOhN3C9fDRXqnAN/Ie20TEwD9Eb2CciV3Ru4Gm7PmDnkHzsljD84qLgBdN39FzPGDyViXTS442xTElWRZMZQfJYQpbMpiePL720kTHgLLAcwTgdP9DnvRPrKukIs/U4Y76NFk7NNbsNOc6FWisLJykw2POTB1RR5ZlZrA4Ax1P7kt7qQdomE6i8wy1TA1jDhG8AhEXKRfpyELvJmzyVIyR9uiSHDHCdihiS5oyjADjmmbklvL7Ns0cSAgEX/lWN8UX8r17zoKZzJ0MkmCQ5Nlfql8qUtn2oZXaHztkkAcXCxkq9/37QIDAQAB"

  • Spark (dev): "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiC2CjQDYZcE1Pn8QHpLh1F32QiJqcO63CObY4ulPEHHmIDfIyflB2WXc7D1bDJtHBahkJEtHY4I8wN8gjowgYVKiiqMpwiuV7Evivyf7Qyvg537Kb0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rOatOdj2QI41J+9Q4eP2TgXBTfJstE5QQIDAQAB"


来源:https://stackoverflow.com/questions/35932942/how-to-load-build-chrome-app-extension-and-run-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!