inherit
161630
0
Apr 7, 2012 23:58:55 GMT -8
jncf
32
January 2011
jncf
|
Post by jncf on Mar 22, 2011 9:27:53 GMT -8
Forum: www.holisticferret60.proboards.comWhen members are using Google Chrome and attempt to quote a post, the following pop-up appears "unable to save quote due to limitation on cookie size. To increase storage capacity consider using a browser that supports a global storage mechanism such as Internet Explorer 5.0 or Firefox 2.0" I know that it's associated with the multiple quote code - I looked through it and saw that the phrase was coded into it. Is there anyway to edit the code so this doesn't pop up? The members are still able to use the quote button without any issue. Thanks EDIT: I would like to also add the the member has attempted to clear her cookies and the problem still persisits.
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Mar 22, 2011 10:53:47 GMT -8
What happens if they try to quote a LARGE amount of text? say near the 4KB mark?
|
|
inherit
161630
0
Apr 7, 2012 23:58:55 GMT -8
jncf
32
January 2011
jncf
|
Post by jncf on Mar 22, 2011 11:03:33 GMT -8
When large posts are quoted, or several posts, I get this response
[removed for security reasons by wildmaven]
It will not allow me back onto the site - I cleared cache and cookies, and then logged back in. All quoted quotes were gone.
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Mar 22, 2011 12:12:36 GMT -8
THAT is what that message is in there for. to prevent that from happening. if the alert is removed, the only course of action would be to make the code just NOT work for the people who would normally have seen the alert. otherwise they will experience the exact same thing you just did.
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,853
December 2005
horace
|
Post by Chris on Mar 22, 2011 18:10:50 GMT -8
What you've described is actually a bug. The code determines if cookies are too large by writing the cookie then reading it back to see if it was truncated. If all the data didn't save then that error is shown. What the code doesn't do however is remove that mangled cookie if there was an error.
At the time that code was written there were only two browsers (IE and Firefox) on the market that supported a storage other than cookies. With the recent addition of support for HTML5 features all browsers (including Safari/Chrome) now support a form of storage other than cookies. To update the code to give full support to Chrome, safari and Opera change the following functions in the code:
function setStorage(_8){ if(!Quotes)return; var _9="Quotes"; var _a=location.host; try{ if(forceCookie)throw "forcecookie"; if(window.globalStorage){ globalStorage[_a].setItem(_9,Quotes.join("\x07")); }else{ if(document.body.addBehavior){ if(!document.getElementById("oPersistDiv"))getStorage(); oPersistDiv.setAttribute(_9,Quotes.join("\x07")); try{ oPersistDiv.save(_a.split(".")[0]); } catch(d){ throw "IE persistence unavailable"; } }else{ throw "no global storage"; } } } catch(e){ forceCookie=true; if(("cookieEnabled" in navigator) && !navigator.cookieEnabled) throw "Cookies unavailable in procedure setStorage"; var b=document.cookie.split(/Quotes\d+=/).length; var c; for(var a=b;a<Quotes.length+b;a++){ c=_9+(a-b).toString()+"="+escape(Quotes[a-b]); document.cookie=c+"; expires=Sun, 17 Jan 2038 10:12:59 GMT;"; if(!document.cookie.match(c))alert(upgrade.replace(/\%s/,(a-b))); } } return true; } function getStorage(_e){ var _f,ret=[]; var _10=location.host; _e=(_e)?_e:"Quotes"; try{ if(forceCookie)throw "forcecookie"; if(window.globalStorage){ _f=globalStorage[_10].getItem(_e); if(_f && _f.value)ret=_f.value.split("\x07"); }else{ if(document.body.addBehavior){ if(!document.getElementById("oPersistDiv")){ oDiv=document.createElement("kbd"); oDiv.id="oPersistDiv"; oDiv.className="userData"; oDiv.style.display="none"; oDiv.addBehavior("#default#userData"); document.body.insertBefore(oDiv,document.body.firstChild); oDiv.attachEvent("onsave",setStorage); } try{ oDiv.load(_10.split(".")[0]); } catch(d){ throw "IE persistence unavailable"; } _f=oDiv.getAttribute(_e); if(_f)ret=_f.split("\x07"); }else{ throw "no global storage"; } } } catch(e){ forceCookie=true; if(("cookieEnabled" in navigator) && !navigator.cookieEnabled) throw "Cookies unavailable in procedure getStorage"; var Q=document.cookie.replace(/Quotes\d+=([^;]+)/gim,function(m,p1,i,s){ ret[ret.length]=unescape(p1); return m; }); } return ret; } function clearStorage(evt){ var _17=location.host; var _18="Quotes"; try{ if(forceCookie)throw "forcecookie"; if(window.globalStorage){ globalStorage[_17].removeItem(_18); }else{ if(document.body.addBehavior){ if(!document.getElementById("oPersistDiv"))getStorage(); oPersistDiv.removeAttribute(_18); try{ oPersistDiv.save(_17.split(".")[0]); } catch(e){ throw "IE persistence unavailable"; } }else{ throw "no global storage"; } } } catch(e){ forceCookie=true; if(("cookieEnabled" in navigator) && !navigator.cookieEnabled)throw "Cookies unavailable in procedure clearStorage"; a=0; while(document.cookie.match(_18+a.toString()+"=")){ document.cookie=_18+a.toString()+"=; expires="+new Date(document.lastModified).toGMTString()+";"; a++; } } finally{ return Quotes=[]; } }
to this
function getDOMStore(){ if(window.globalStorage)return globalStorage[location.hostname]; if(window.localStorage) return window.localStorage; if(document.body.addBehavior){ var a=document.getElementById('persistie'),b; if(!a){ a=document.links[0].appendChild(document.createElement('input')); a.className=='userData'; a.type="hidden"; a.value=""; a.id="persistie"; a.addBehavior("#default#userData"); } b={storage:a, setItem:function(key,data){this.storage.setAttribute(key,data);this.storage.save(pb_forum);}, getItem:function(key){this.storage.load(pb_forum);return this.storage.getAttribute(key);}} return b; } return null; } function setStorage(_8){ if(!Quotes)return; var _9="Quotes"; var _a=location.host,storage; var upgrade="Unable to save quote %s due to limitation on cookie size. \nYour browser doesn't support or has global/local storage disabled which is why the smaller capacity of cookie is being used."; try{ if(forceCookie)throw "forcecookie"; if((storage=getDOMStore())){ storage.setItem(_9,Quotes.join("\x07")); }else{throw "no global storage";} }catch(e){ forceCookie=true; if(("cookieEnabled" in navigator) && !navigator.cookieEnabled) throw "Cookies unavailable in procedure setStorage"; var b=document.cookie.split(/Quotes\d+=/).length; var c; for(var a=b;a<Quotes.length+b;a++){ c=_9+(a-b).toString()+"="+escape(Quotes[a-b]); document.cookie=c+"; expires=Sun, 17 Jan 2038 10:12:59 GMT;"; if(!document.cookie.match(c)){ alert(upgrade.replace(/\%s/,(a-b))); document.cookie=c+"; expires="+new Date(document.lastModified).toGMTString()+";"; } } } return true; } function getStorage(_e){ var _f,ret=[]; var _10=location.host; _e=(_e)?_e:"Quotes"; try{ if(forceCookie)throw "forcecookie"; if((storage=getDOMStore())){ _f = storage.getItem(_e); if(_f ){ if(_f.value)ret=_f.value.split("\x07"); else if(_f.length) ret = _f.split("\x07"); } }else{throw "no global storage";} }catch(e){ forceCookie=true; if(("cookieEnabled" in navigator) && !navigator.cookieEnabled) throw "Cookies unavailable in procedure getStorage"; var Q=document.cookie.replace(/Quotes\d+=([^;]+)/gim,function(m,p1,i,s){ ret[ret.length]=unescape(p1); return m; }); } return ret; } function clearStorage(evt){ var _17=location.host; var _18="Quotes"; try{ if(forceCookie)throw "forcecookie"; if((storage=getDOMStore())){ storage.removeItem(_18); }else{throw "no global storage";} } catch(e){ forceCookie=true; if(("cookieEnabled" in navigator) && !navigator.cookieEnabled)throw "Cookies unavailable in procedure clearStorage"; a=0; while(document.cookie.match(_18+a.toString()+"=")){ document.cookie=_18+a.toString()+"=; expires="+new Date(document.lastModified).toGMTString()+";"; a++; } } finally{ return Quotes=[]; } }
I haven't tested this change so please let me know your results.
I can tell you though that anybody using IE8 will "lose" their saved quotes. It won't actually be lost since it will still be on their computer but since IE will be using the newer localStorage rather than the legacy IE5 storage they'll have nothing in the newer. Same goes for browsers such as Safari/Chrome that previously used cookies and have now switched to localStorage.
|
|
inherit
161630
0
Apr 7, 2012 23:58:55 GMT -8
jncf
32
January 2011
jncf
|
Post by jncf on Apr 2, 2011 12:02:04 GMT -8
I tried implementing the new code you provided, but it made it where the "Add Quote" button no longer worked. The browser (Chrome) froze up and the forum would not respond.
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,853
December 2005
horace
|
Post by Chris on Apr 2, 2011 12:12:01 GMT -8
Can you put the code exactly as you had it modified on a test forum and post or PM me the url
|
|
inherit
161630
0
Apr 7, 2012 23:58:55 GMT -8
jncf
32
January 2011
jncf
|
Post by jncf on Apr 2, 2011 14:44:51 GMT -8
I tried it again and it is now working great I have quoted tons of posts (including pictures) with no issue whatsoever. Thank you for the update www.holisticferret60.proboards.com - It's on this forum
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,853
December 2005
horace
|
Post by Chris on Apr 2, 2011 16:24:22 GMT -8
I tried it again and it is now working great I have quoted tons of posts (including pictures) with no issue whatsoever. Thank you for the update www.holisticferret60.proboards.com - It's on this forum OK thanks for the reply. I had a read of your code use instructions and kudos for keeping it simple, I'd however like to point out that the full potential of the code is not being used there, not sure how computer savvy your members are however. The ability to select multiple portions of a single post and quote just those selected portions with full adjusted markup support as well as quoting from threads that might no longer be write-accessible (locked/read only board) are actually the strong points of the code. (no limit on how many portions of a single post can be quoted) By "adjusted markup" I mean should you select text/html that spans discrete elements within the post the parent containers will be automatically recreated with just the selected portions reinserted. For example, selecting just two items in a [ list] of 10 items will recreate the list with just those 2 items.
|
|
inherit
161630
0
Apr 7, 2012 23:58:55 GMT -8
jncf
32
January 2011
jncf
|
Post by jncf on Apr 12, 2011 6:26:52 GMT -8
Thank you. I see what you mean. I think there are only a couple who actually use the quote feature, but I let them know that the feature has more capabilities.
|
|