Firefox 扩展可在位置/地址栏中创建新图标或替换现有图标
我想创建一个 Firefox 扩展,它可以在地址栏中创建一个新图标,或者用扩展中指定的图标替换现有图标。
然后,添加一些 JavaScript 以仅在用户查看特定域时显示此自定义徽标。
如果这对于位置/地址栏不可行,则可以在状态栏上显示徽标(同样由 javascript 驱动,仅当用户位于特定域时才显示徽标)。
这可以做到吗?
我认为仅靠图标并不能解决我的问题。我希望仅当用户位于特定域时才能够显示图标/徽标(例如 xyz.com/testPage.html 或 abc.com/anotherTest.html)
I want to create a Firefox extension that creates a new icon in the address bar or replaces the existing one with the one specified in the extension.
And then, add some javascript to display this custom logo only when the user is viewing a particular domain.
If this is not doable for the location/address bar, displaying the logo on the status bar is ok (again driven by a javascript that displays the logo only when the user is on a particular domain).
Can this be done?
I don't think favicon alone will solve my problem. I want to be able to display the icon/logo only when the user is on a specific domain (e.g. xyz.com/testPage.html or abc.com/anotherTest.html)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需使用 Greasemonkey 即可做到这一点。这里你有一个可以运行的快速脚本。
Greasemonkey 手册:(添加脚本)
如果您尝试更改网站图标已经有一个,你必须
在设置新的图标之前执行类似的操作,但我无法让它工作。
有一个项目来创建用于图标操作的标准对象,该项目应该可以工作,但对我不起作用。
You can do that just using Greasemonkey. Here you have a quick script that works.
Greasemonkey's manual: (Adding scripts)
If the site whose favicon you are trying to change already has one, you will have to do something like
before setting the new favicon, but I couldn't get it to work.
There is a project to create a standard object for favicon manipulation that is supposed to work, but didn't work for me.
您可以更改 DOM 创建链接元素,如下所示:
You can alter the DOM creating a link element like this :