开发者

How do I access currently selected text from a bookmarklet, while on gmail.com

I'm using FF 3.5.3 on Windows Vista.

This is my (edited for shortness) bookmarklet:

javascript:(function(){
var text = window.content.getSelection().toString();
alert(text);
})();

Works, but not on gmail.com. Probably due to dynamicly generated content.

I'm aware of this workaroun开发者_如何学运维d, but it only works for Firefox extensions.


Gmail using frames. Try:

document.getElementById('canvas_frame').contentWindow.getSelection().toString();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜