I want to highlight a selection of text on a web page. I have gone through this solution suggested by Tim Down which does half the job for me.
Now I need a way to highlight the text permanently. By permanently, I mean when I highlight some text, close the browser then re-open the page from local, the text should remain highlighted. Tim's solution keeps the text highlighted as long as I don't refresh or close the page. I guess I need to save the range's start and end offset somewhere so that next time I re-open the page I can highlight all the ranges again.
Edit: Sorry, forgot to mention that I am working on iPhone so I can keep an array of selections on local for a specific page. Any solution to store range for selection which can be nested or across multiple elements (e.g. div
/p
/span
)?