简体   繁体   English

有没有办法通过Chrome扩展程序禁用chrome_url_override?

[英]Is there a way to disable chrome_url_override via a Chrome Extension?

Here's the background on my question: I have a chrome extension that overrides the user's new tab with the extension. 以下是我的问题的背景:我有一个chrome扩展名,它会覆盖用户带有扩展名的新标签页。 It is using the chrome_url_overrides permission to override the newtab with my extension. 它使用chrome_url_overrides权限覆盖带有我的扩展名的newtab。

I need a way to disable this feature since some of our users want to only show our extension when they choose to. 我需要一种方法来禁用此功能,因为我们的一些用户只想在他们选择时显示我们的扩展程序。

I looked through all the Google Chrome Extension apis and could not find a programmatic way of doing it. 我查看了所有Google Chrome扩展程序api,但找不到编程方式。

You could use a local setting to detect if the user wants to see the new tab page or not. 您可以使用本地设置来检测用户是否想要查看新标签页。 If they don't want your new experience, you could redirect the newtab to the internal newtab via: 如果他们不想要您的新体验,您可以通过以下方式将newtab重定向到内部newtab:

chrome.tabs.update({
  url: 'chrome-internal://newtab/'
});

See: https://stackoverflow.com/a/15016689/76734 请参阅: https//stackoverflow.com/a/15016689/76734

@Dalze you can easily fix the flicker by adding a css to the body: set display:none and then if you are loading your newtab change it to show with js - this way you won't have the flicker. @Dalze你可以通过向身体添加一个css来轻松修复闪烁:set display:none然后如果你正在加载你的newtab改变它以用js显示 - 这样你就不会有闪烁。 (sorry for adding an answer, I was unable to comment above :) (抱歉添加了答案,我无法评论上面:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM