Is there any JS functionality to get the text that is currently viewed by a user?
Assume there is a page with some text (or a lot of text) and I need some javascript-written black box that can retrieve text (any text within div, p, span … or any other tags) that is currently visible on user’s screen.
This should take in account the fact that user can scroll the page, only currently viewed text must be retrieved.
Is that possible with javascript?
How can this be implemeneted? (primarily for use in Firefox)
Do you know any js library that provides this functionality???
Thank you =)
I’ve created an example for you: http://jsfiddle.net/manuel/kuHHw/
I’m using jquery with the viewport selector plugin. The example shows the visible div’s in green and appends the innerHTML into the span at the bottom of the page