i am wondering if the "LIKE '%pattern%' is available in the sql like html5 request storage engine?
i would like to implement a local search to know which embedded html pages to display in a full offline mobile web app开发者_JS百科lication...
exemple : A.html -> "info about A" B.html -> "info about B"
a search input combobox, the user type "A", then a sql request is done with like "%A%" Then all matched results are displayed, then the user select the page he really wants, then the page is displayed...
Have you any ideas?
Thank you
I'm guessing you just need something like this.
http://www.tizag.com/javascriptT/javascript-string-search.php
It looks like the localStorage is not searchable with conditions like a SQL database is, and this is something that is probably going to be addressed by IndexedDB when it is finally implemented.
The best seems to be to loop over all localStorage
items and then try to match each key or value using a regex. Like so:
for (var i = 0, i < window.localStorage.length, i++) {
index = window.localStorage.key(i);
if (index.match(/^string/)) {
// your code...
}
}
精彩评论