I am working on a Chrome Extension and would like the extension to be able to periodically check if it has permission (via the check box on the chrome://extensions page) to run in incognito mode. Is there anyway of doing this?

Obviously, I could just monitor for new windows and if it is an incognito window then I know that it has permission. However this method wouldn't tell me explicitly if I don't have permission. Another possibility is to have it actually create new incognito windows periodically and check if it has access to them, but that can get annoying for the user.

有帮助吗?

解决方案

There's an existing function for it: chrome.extension.isAllowedIncognitoAccess:

chrome.extension.isAllowedIncognitoAccess(function(/*boolean*/ isAllowedAccess) {
    // ...
});
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top