开发者

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

开发者 https://www.devze.com 2022-12-08 09:19 出处:网络
I\'m using FF 3.5.3 on Windows Vista. This is my (edited for shortness) bookmarklet: javascript:(function(){

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

精彩评论

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