我的Chrome插件如何通过Javascript禁用它自己? [英] How can my Chrome plugin disable itself via Javascript?

查看:109
本文介绍了我的Chrome插件如何通过Javascript禁用它自己?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Chrome浏览器插件要求用户登录到服务器以发回用于生成报告的信息。我想让用户选择登录或禁用插件,这样它就不会再要求他们登录。我怎样才能通过自己的Javascript禁用插件?


<解决方案


当然,您无法以编程方式启用它。


My Chrome plugin requires the user to be logged in to a server to send back information for generating reports. I'd like to give the user the option to either log in or disable the plugin so that it will stop asking them to log in. How can I disable the a plugin via its own Javascript?

解决方案

chrome.management.setEnabled(chrome.i18n.getMessage("@@extension_id"), false);

You can't programmatically enable it after this, of course.

这篇关于我的Chrome插件如何通过Javascript禁用它自己?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆