[英]Javascript bookmarklet with image on github readme
我在将带有图像的 javascript 书签添加到我的 github 自述文件时遇到了麻烦。 该图像应该使用户可以轻松地将书签添加到他的书签栏。
基本上 这个(http://alaingilbert.github.com/Turntable-API/bookmarklet.html)是我想要实现的,而是在github自述文件中。
到目前为止,我有这个:
<table style="border: none;">
<tbody>
<tr style="border:none;">
<td style="vertical-align: middle; padding-top: 10px; border: none;">
<a href="javascript:(function(){ window.open(‘http://www.test.com/’); })();">
<img src="http://i.imgur.com/vCSDi.png">
</a>
</td>
<td style="vertical-align: middle; text-align: left; border: none;">
← Drag this to your bookmark bar.
</td>
</tr>
</tbody>
</table>
但是当我在 github 上查看自述文件的源代码时,我注意到 href 属性似乎已经消失了,因此书签将不再起作用。
github 会自动删除 javascript href 吗? 有没有办法解决这个问题?
编辑:来自 table、tbody、tr 和 td 标签的属性似乎也消失了。 好像github不喜欢他们?
尝试更改此:
v v
<a href="javascript:(function(){ window.open(‘http://www.test.com/’); })();">
^ ^
对此:
v v
<a href="javascript:(function(){ window.open('http://www.test.com/'); })();">
^ ^
您当前使用的引号不是有效的Javascript引号分隔符
编辑:演示:
重复:在 GitHub README.md 中嵌入书签。 也有正确答案。 无法从 github 存储库自述文件中提供书签。 相反,您可以使用 github 页面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.