如何拥有图标/图标集时,书签拖到工具栏? [英] How to have favicon / icon set when bookmarklet dragged to toolbar?

查看:132
本文介绍了如何拥有图标/图标集时,书签拖到工具栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了自己一个书签,它的功能就好了,但是当加入到在Opera或Firefox工具栏,它只是需要对浏览器的默认书签图标(一个地球仪和一个明星,分别)。我的网站有一个图标,窗口,选项卡,甚至[站点]书签使用我所指定的图标。只是不是我的书签。

I've made myself a bookmarklet, and it functions just fine, but when added to a toolbar in Opera or Firefox, it just takes on the default bookmark icon for the browser (a globe and a star, respectively). My site has a favicon, and the window, tab and even [site] bookmark uses the favicon I've specified. Just not my bookmarklet.

我怎样才能code我的网站或书签,这样的书签得到图标,也?

How can I code my site or bookmarklet so that the bookmarklet gets the favicon, too?

我所知道的各种手工两轮牛车技术的用户可以使用设置在事后的图标,但这些都是不可取的解决方案。

I'm aware of various manual hackery techniques users can use to set the favicon after the fact, but those are undesirable solutions.

推荐答案

一个书签使用的javascript:// 模式,因此没有一个域从一个图标可以装载。

A bookmarklet uses the javascript:// schema and thus do not have a domain from which a favicon may be loaded.

因此​​,目前还没有办法为你提供了一个书签一个图标。想想看这样的:记得整个的Javascript沙箱的东西 - 在它运行的JavaScript可能不是网页外域的访问什么?嗯,这需要在连接到一个书签无论域你正在看,不能也绑到一个图标在您自己的网站。在当前页

So, currently there is no way for you to provide a favicon for a bookmarklet. Think about it like this: remember the whole Javascript sandbox thing - where Javascript may not access anything outside the domain of the web page where it is running? Well a bookmarklet that needs to be tied in to whatever domain for the current page you are watching, cannot be also tied in to a favicon on your own web site.

更新:根据汉斯Schmucker的回答,则建立一个书签,当通过浏览器加载到书签菜单,就会产生一个具有一个图标的HTML文档的可能性。其理由似乎像它可以工作,但我还没有看到在行动这样的事情,我的测试都回来了阴性。

Update: According to Hans Schmucker's answer, there is a possibility to create a bookmarklet that when loaded by the browser into the bookmark menu it will generate an HTML document that has a favicon. The reasoning seems like it may work but I have yet to see something like this in action and my tests have came back negative.

这篇关于如何拥有图标/图标集时,书签拖到工具栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆