在 Firefox 扩展中嵌入 SWF 文件

发布于 2025-01-06 07:23:20 字数 142 浏览 2 评论 0原文

我正在开发 Chrome、Safari 和 Firefox 的扩展程序,我需要在扩展程序中添加 SWF 文件。我想在页面上显示它。我在文档中读到我可以在 Chrome 和 Safari 扩展程序中存储媒体文件。

我可以用 Firefox 做同样的事情吗?

I'm developing extensions for Chrome, Safari and Firefox, and I need to add SWF file in my extension. I want to show it on a page. I read in documentation that I can store media files in Chrome and Safari extension.

Can I do the same with Firefox?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

月朦胧 2025-01-13 07:23:20

是的,Firefox 扩展还可以包含您喜欢的任何文件。但您可能想问:“我可以在扩展程序中获取可在网页上使用的文件的 URL 吗?”如果您使用附加 SDK 那么它很简单

var self = require("self");
var url = self.data.url("file.swf");

:附加组件稍微复杂一些 - 出于安全原因,网页通常无法使用 chrome:// URL。不过,您可以在 为您的命名空间指定 contentaccessible 标志 code>chrome.manifest,例如:

content myextension chrome/content/ contentaccessible=yes

那么网页将能够使用chrome://myextension/content/file.swf。另一种选择是注册resource://命名空间,这些始终可以从网页访问。

Yes, a Firefox extension can also contain any files you like. But you probably meant to ask: "Can I get a URL of a file in my extension that will be usable on a web page?" If you are using the Add-on SDK then it is simply:

var self = require("self");
var url = self.data.url("file.swf");

In a classic add-on it is slightly more complicated - chrome:// URLs normally cannot be used by web pages, for security reasons. You can however specify the contentaccessible flag for your namespace in chrome.manifest, e.g.:

content myextension chrome/content/ contentaccessible=yes

Then web pages will be able to use chrome://myextension/content/file.swf. The other option would be to register a resource:// namespace, these are always accessible from web pages.

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