Re: Content script can't get selection from iframe (was:Best way to get selected text from google doc page(iframe?))

160 views
Skip to first unread message

arthur zhang

unread,
Nov 24, 2010, 11:15:20 AM11/24/10
to Chromium-extensions
After two days testing, looks content script can't get iframe's
selection at all (e.g. edit area of google doc).

I have "all_frames": true, in manifest.json to make sure the content
script is running with iframe, and add event handler to both mousedown
and mouseup events. After using mouse to select something in the
iframe, both of the events got fired but in mouseup handler,
windows.getselection() returns nothing and e.target.contentWindow is
not accessible.

Can anyone confirm that content script can't get selection from iframe.

Thanks.

On Mon, Nov 22, 2010 at 12:48 PM, arthur <mail2...@gmail.com> wrote:
> Hi All, my background page gets page's selected text by sending message to
> content script which responses with window.getselection().
>
> With google doc pages, I am not sure if it is caused by the iframes, the
> background page always get null response from page's content script (from a
> iframe which has no selection??).
>
> So what is the best way to send selected text to background page? Should I
> capture selection with mouseup event in page and post to background instead
> of query from background page? If so, what about pasted text?
>
> Thanks.
>

Reply all
Reply to author
Forward
0 new messages