Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Disabling back button only up to a point

I did some research for a couple days, crossing this forum and the old Google group, so I was hoping I might be able to make myself as clear as possible to know if this was even doable, and if so, how.

I hope for the back button to be disabled at certain points in the story, and the player can't go backward beyond that point. Sort of like a one-way link, I want two links available for the player to choose, and upon clicking one, they go into the branch of story without being able to return to the passage with the choice I previously gave.

Sort of a way to keep players from- I don't know- being indecisive, I guess.

Don't want to disable the back button completely, because I want them to be able to go back to read anything they want...but only up to the point I designate.

Is this possible?

Comments

  • It almost sounds easier to disable the back button, then only include a back/return macro where you want it.
  • The functionality of the Back button is controlled by the History feature built into the Story Format header as well as the browsers own history functionality. As you progress through the passages within your story the History feature records which passages you have been to and uses this information when the Back button is pressed. If there is no History then the Back button becomes disabled.

    I can think of two ways to achieve what you want:

    1. As Hanon Ondricek stated, you could use java-script to disable the back button on the Passage(s) that the Reader see directly after the Passage containing the Branching links, this would stop them from being able to return to the Branching links. You would have to re-enable the back button after that passage.

    eg. Given the following set of passages, where B is the passage that contains the branching links that you don't want the user to be able to revisit.

    A => B => C => D
    \
    => E => F
    You would disable the Back button in passages C & E, and re-enable the Back button in passages D & F.

    2. The second option would be to delete/clear out all the relevant history information when the user reaches passages C & E, though I don't know of any story header feature that allows you to do this, nor do I know what the other ramification of doing this would be. You would need to talk to either Leon or TheMadExile about this depending on if your using Sugarcane or SugarCube.
  • caelondian wrote:
    Is this possible?


    Not as you've described, no.  The only way to take control over the browsers' back/forward buttons is to use the Window History API.  Unfortunately, browsers' Window History API does not give the amount of control required to pull this off.  Notably, it only allows you to add new states and replace the current state, not modify arbitrary states within the history.  In other words, you cannot turn it off and on upon demand nor can you invalidate past/non-current history states.
  • Thank you guys so much. I figured there'd be a way around it, but not necessarily exactly like I wanted. Which is perfect. Just takes a bit of work, but that's all well enough. What I'll most likely do is disable it completely and just use internal navigation to control the flow. Thank you, Hanon, greyelf, and TheMadExile!
Sign In or Register to comment.