2

How can I save a range (based on user selection) and reload it the next time the user visit my page again?

Details: the user selects a portion of text and I highlight it with a span. Now I have to save the "coordinates" of the selected text, so the next time the user visits my page, I'll load the range coordinates from my db and highlight the text with a span.

4

3 回答 3

1

看看Rangy库。它会做你想做的事,甚至更多。您可以查看Serializer模块和Highlighter模块(此模块仍处于 alpha 阶段,因此可能不稳定)。

于 2013-06-03T17:52:30.337 回答
0

一些类似的答案:

另外(自我推销提醒)你可以试试Rangy 的荧光笔模块

于 2013-06-03T17:30:52.620 回答
0

如果您使用的是 html5,则可以使用 Web Storage API。

循环: http ://www.w3schools.com/html/html5_webstorage.asp

于 2013-06-03T17:37:53.960 回答