jamting
jamting

Reputation: 1685

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 workaround, but it only works for Firefox extensions.

Upvotes: 4

Views: 1306

Answers (1)

NVI
NVI

Reputation: 15045

Gmail using frames. Try:

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

Upvotes: 6

Related Questions