我可以仅通过浏览器窗口中的图像调用 Javascript 书签吗?例如:blah.com/blah.jpg?
If I'm at a url... say http://i.imgur.com/JcxmE.jpg where it is just the image file, how can I make a window/div appear over the image when the bookmarklet is called?
Instapaper does this.
So far my bookmarklet loads an external javascript file, which in turn creates a div and appends it to the body.
This doesn't work when it is just an image.
Ideas?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,看起来 Firefox 仍然会在图像上渲染 DOM。 hello world 示例仅当您将其粘贴在书签中时才有效,而不是直接粘贴在 URL 栏中。
只要您的浏览器呈现 DOM,即使在纯图像 url 上,下面的示例也应该有效。它将把图像插入到容器元素中。
Alright it looks like firefox still renders a DOM even over images. The hello world example works only if you stick it inside a bookmarklet, but not straight in the url bar.
Here's an example that should work as long as your browser renders a DOM even on pure image urls. It will insert the image inside a container element.
嗯,看起来你做不到,至少在 Firefox 中做不到。即使像
javascript:alert('Hello World');
这样简单的代码也不适用于图像。亲自尝试该代码。Well it doesn't look like you can, at least not in Firefox. Even something as simple as
javascript:alert('Hello World');
doesn't work on an image. Try that code for yourself.