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
  • 22,531
  • 20
  • 68
  • 106

1 Answers1

1
window.getSelection().selectAllChildren(document.body);
window.getSelection().collapseToStart();
Neil
  • 54,642
  • 8
  • 60
  • 72