开发者

Bookmarklet javascript working in Chrome but no Firefox or Safari

开发者 https://www.devze.com 2023-03-12 10:00 出处:网络
I want to use this bookmarklet for flickr, the code I have is this javascript:prompt(\'Copy the BBcode below\',\'<div class=\"img-link\"><a href=\"\'+location.href+\'\">\'+document.evalua

I want to use this bookmarklet for flickr, the code I have is this

javascript:prompt('Copy the BBcode below','<div class="img-link"><a href="'+location.href+'">'+document.evaluate('//h1[@class="photo-title"]',document,null,XPathResult.STRING_TYPE,null).stringValue+'</a>')

So in Chrome, when I am at a page at Flickr (e.g this http://www.flickr.com/photos/zapeipaa/4876022306/in/photostream/ ), I click the bookmarklet and get the prompt with the code

<div class="img-link"><a href="http://www.flickr.com/photos/zapeipaa/4876022306/in/photostream/">Peace Memorial Park</a>

However in both Firefox and Safari the photo-title (in this case "P开发者_JAVA百科eace Memorial Park") is left out completely.

Is there a way to work around and get it to work in Safari at least?

0

精彩评论

暂无评论...
验证码 换一张
取 消