0

I have some code that uses a native mozilla browser and it does a find on the text, however this works from wherever the user last clicked. I need it to start from the top of the document but the API doesn't have any decent way of doing this so I was thinking it may be possible by executing javascript on the page. Anyone know how to do this? Basically I want to set the caret position to 0.

Rocky Pulley
  • 21,409
  • 19
  • 65
  • 104

1 Answers1

1
window.getSelection().selectAllChildren(document.body);
window.getSelection().collapseToStart();
Neil
  • 52,766
  • 8
  • 57
  • 71