I used to have a script that used GM_setValue() to store a chunk of html from a page, and load it on another page.
So:
var data = '
GM_setValue("test", data);
alert(GM_getValue("test", "failed"));
would alert
Recently we moved away from the GM API in favor of jQuery and HTML5, and replaced GM_setValue GM_getValue with functions like:
function $setVal(name, value){
localStorage.setItem(name, value);
return false;
}
function $getVal(name, notset){
return localStorage.getItem(name) || notset;
}
The problem is now that it can no longer store strings of HTML like the GM equivs can. With the new functions in place, the example script would alert failed.
i've tried escaping with regex's, and escaping with escape(), but I'm having no luck.
Anyone know what to do?
EDIT: the awkward thing is, this actually seems to work fine. just not in the scope I need it to. I have a text box that is simply evaled as javascript on submission for testing, and when I call the function from there, it works, however chucks an error when called by the code.
Thanks you for your help, but it doesn't actually seem to be a problem the same way I thought it was, sorry.