Revision of Twine: eliminate the back button functionality in Sugarcane from Mon, 02/25/2013 - 23:58

If you want to remove the browser's Back button functionality in Sugarcane, to prevent the player from rewinding or undoing moves, here is some script code that can do that:

History.prototype.save=function(c){var a="";for(var b=this.history.length-1;b>=0;
b--){if((this.history[b].passage)&&(this.history[b].passage.id)){a+=this.history[b].passage.id.toString(36)+".";
}}this.history[0].hash="#"+a.substr(0,a.length-1);return"";};

This will prevent previously visited passages from appearing in the player's browser history, except for the Start passage (since it's loaded before custom scripts are), and any passages revisited using the Rewind menu.