Google Chrome 扩展程序的域名是什么?
我目前正在构建一个 Google Chrome 扩展程序,在扩展程序窗口中显示 Twitch 播放器。为此,我需要拥有托管扩展程序的域/网站。在这种情况下,我猜它是 Google Chrome,但我不太明白如何获取确切的域名。
提前致谢!
I am currently building a Google Chrome extension displaying a Twitch player within the extension window. To do so I need to have the domain / website on which the extension is hosted. In this case I guess it would be Google Chrome but I don't quite understand hwo to get the exact domain name.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它们根本不托管在任何域上,而是由 Chrome 直接从扩展程序的本地副本加载。 URL 中使用的方案是
chrome-extension://
,而不是http://
或https://
。例如:如果您需要向 Twitch 提供域名(例如,在其 CORS 策略或类似策略中获得密码列表),则根本没有域名可以提供给他们。 (我没有尝试过,但 Chrome 扩展程序默认情况下确实被锁定,我怀疑您甚至可以嵌入从您控制的域加载的
iframe
。扩展程序是隐私和安全的噩梦,因此 Google 锁定他们彻底地倒下了。)They aren't hosted on any domain at all, they're loaded directly by Chrome from its local copy of the extension. The scheme used in the URL is
chrome-extension://
, nothttp://
orhttps://
. For instance:If you need to provide Twitch with a domain (for instance, to get passlisted in their CORS policy or some such), there's simply no domain to give them. (I haven't tried, but Chrome extensions are really locked down by default, I doubt you could even embed an
iframe
loaded from a domain you control. Extensions are a privacy and security nightmare, so Google locks them down pretty thoroughly.)