How to access the currently selected text from the bookmarklet, and on gmail.com

I am using FF 3.5.3 on Windows Vista.

This is my (edited for brevity) bookmarklet:

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

It works, but not on gmail.com. Probably due to dynamically generated content.

I know this workaround, but it only works for Firefox extensions.

+4
source share
1 answer

Gmail using frames. Try:

 document.getElementById('canvas_frame').contentWindow.getSelection().toString(); 
+6
source

All Articles