docs: function setupBeforeUnloadListener () {
  		window.addEventListener('beforeunload', function(e) {
  			// Don't save anything unless the user opted in to storage
  			if (!document.cookie.match(/(?:^|;\s*)store=(?:prefsAndContent|prefsOnly)/)) {
  				return;
  			}
  			var key;
  			if (document.cookie.match(/(?:^|;\s*)store=prefsAndContent/)) {
  				setSVGContentStorage(svgCanvas.getSvgString());			
  			}
  
  			svgEditor.setConfig({no_save_warning: true}); // No need for explicit saving at all once storage is on
  			// svgEditor.showSaveWarning = false;
  
  			var curPrefs = svgEditor.curPrefs;
  
  			for (key in curPrefs) {
  				if (curPrefs.hasOwnProperty(key)) { // It's our own config, so we don't need to iterate up the prototype chain
  					var val = curPrefs[key],
  						store = (val != undefined);
  					key = 'svg-edit-' + key;
  					if (!store) {
  						continue;
  					}
  					if (storage) {
  						storage.setItem(key, val);
  					}
  					else if (window.widget) {
  						widget.setPreferenceForKey(val, key);
  					}
  					else {
  						val = encodeURIComponent(val);
  						document.cookie = encodeURIComponent(key) + '=' + val + '; expires=Fri, 31 Dec 9999 23:59:59 GMT';
  					}
  				}
  			}
  		}, false);
  	}