开发者

Saving history of usage to offer suggestions

  • I have a small extension that perform local search.
  • It searches for the files matching that name in the local company files list and then opens a page with the results.
  • The extension has a text box where users type in the query.

The problem is that if I click the extension again and want to do a query that I already did previously, I need to type it开发者_运维技巧 out again.

  • I want the textbox to save history, and show suggestions when I start typing a new query.

How can I do this? The suggestion matching can be a very simple string matching, nothing fancy. But how/where canI save the history?


If you are asking about standard browser's autocomplete then I don't think there is a way to programmatically create it.

You can build your own with jQuery's autocomplete plugin, for example. You will just feed it previous queries and it will do the rest.

To store previous queries you can use localStorage, which you would need to access from a background page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜