Google Chrome 扩展程序的域名是什么?

发布于 2025-01-10 03:41:54 字数 133 浏览 0 评论 0原文

我目前正在构建一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天生の放荡 2025-01-17 03:41:54

为此,我需要拥有托管扩展程序的域/网站。

它们根本不托管在任何域上,而是由 Chrome 直接从扩展程序的本地副本加载。 URL 中使用的方案是 chrome-extension://,而不是 http://https://。例如:

chrome-extension://longstringofcharactershere/filename.html

如果您需要向 Twitch 提供域名(例如,在其 CORS 策略或类似策略中获得密码列表),则根本没有域名可以提供给他们。 (我没有尝试过,但 Chrome 扩展程序默认情况下确实被锁定,我怀疑您甚至可以嵌入从您控制的域加载的 iframe。扩展程序是隐私和安全的噩梦,因此 Google 锁定他们彻底地倒下了。)

To do so I need to have the domain / website on which the extension is hosted.

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://, not http:// or https://. For instance:

chrome-extension://longstringofcharactershere/filename.html

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.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文