docs: function setupBeforeUnloadListener () {
  		window.addEventListener('beforeunload', function(e) {
  			// Don't save anything unless the user opted in to storage
  			if (!document.cookie.match(/store=(?:prefsAndContent|prefsOnly)/)) {
  				return;
  			}
  			var key;
  			setSVGContentStorage(svgCanvas.getSvgString());
  
  			svgEditor.showSaveWarning = false;
  
  			var curConfig = svgEditor.curConfig;
  			for (key in curConfig) {
  				if (curConfig.hasOwnProperty(key)) { // It's our own config, so we don't need to iterate up the prototype chain
  					var d,
  						storage = svgEditor.storage,
  						val = curConfig[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 {
  						d = new Date();
  						d.setTime(d.getTime() + 31536000000);
  						val = encodeURIComponent(val);
  						document.cookie = key + '=' + val + '; expires=' + d.toUTCString();
  					}
  				}
  			}
  		}, false);
  	}