Howdy, Stranger!

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

Browser 'Back' button (Sugarcube 2.11.0)

edited November 2016 in Help! with 2.0
Can someone please clear up a little puzzle. When I test my game in the browser, the 'Back' button remains inactive throughout. When I discovered this I was delighted, and assumed it was part of Sugarcube's make-up to stop people casually pressing 'Back' when they made a bad or fatal choice in the game. But on testing several other games from Twine's main page - some of which clearly use a version of Sugarcube - they all have an active browser 'Back' button when playing, and as feared I can simply hit this to return to the previous passage.

Is the inactive browser navigation unique to Sugarcube 2, or am I missing something here?

My browser is Firefox and please note I'm referring to the browser's < > buttons, not Sugarcube's 'Backwards' / 'Forwards' links.

Comments

  • If you search the forum for "Chromium" you will find a number of threads related to this issue, basically Chromium (the code behind the Chrome and Opera web-browsers) was changed to limit/restrict access to the web-browser's Navigation History system for any HTML file run from the local hard-drive.

    This in turn effected how some story formats handled their own internal History so some of those story formats (later versions of SugarCube 1.x and 2.x in particular) were changed to use a more advanced technique to track History, unless the relevant web-browser did not support it.
  • Okay, I'll take a look at that stuff, but forgive if I ask here too.

    In a nutshell, what I want to know is will players who launch my game be able to move back and forth using the browser's nav buttons?

    And is the reason I can do so with other people's game but not my own, because I'm running my game from my local hard-drive?
  • Jud_Casper wrote: »
    In a nutshell, what I want to know is will players who launch my game be able to move back and forth using the browser's nav buttons?
    No. SugarCube v2 does not support browsers' history API.

    Jud_Casper wrote: »
    And is the reason I can do so with other people's game but not my own, because I'm running my game from my local hard-drive?
    No. In all likelihood, those projects are using SugarCube v1 or one of the Twine v1.4 vanilla story formats, which do make use of browsers' history API.


    The reason that newer story formats do not make use of browsers' history API are probably manifold—certainly true for SugarCube v2—however, the primary reason is likely that alluded to by greyelf. With Chromium v45—also used as the core of Chrome and Opera—its developers made the decision to make all uses of the browser history API throw an exception if the file was loaded locally. As there is no way around that problem, other than to not load files locally, and since it was/is unclear if other browsers would follow suit, the use of browsers' history API was largely dropped from story formats.
  • Great! That's the answer I wanted. Thank you.
  • I will try to be more clear with my answers this time.
    Jud_Casper wrote: »
    In a nutshell....
    This depends on three things:

    1. Which story format was used to create the story HTML file.

    eg. All the story format's that come with the Twine 1 application (Sugarcane, Jonah, Responsive) use the web-browser's Navigation History system to handle the story's own internal History, so any story's created using these story formats will allow the reader to use the web-browser's Back and Forward buttons to undo/redo history.


    2. The version of story format used to create the story HTML file.

    eg. (Very) Old versions of SugarCube used the web-browser's Navigation History system, so any story's created using these versions will allow the reader to use the web-browser's Back and Forward buttons to undo/redo history.


    3. The brand and/or version of the web-browser being used by the reader when running the story HTML file from their local hard-drive.

    Some brands or older versions of web-browsers do not support some of the more advanced methods being use by modern story formats to track History, depending on which particular story format was used to create the story HTML file (eg. recent versions of SugarCube) this may result in the story automatically downgrading to use the web-browser's Back and Forward buttons to undo/redo history.

    Jud_Casper wrote: »
    And is the reason I can do so with other people's game but not my own, because I'm running my game from my local hard-drive?
    You have stated you are using (a recent version of) SugarCube and Firefox to create and view your story(ies), so the two reasons you can't use the web-browser's Back and Forward buttons in your stories are:

    1. The version of SugarCube you are using uses a more advanced method to track history.

    2. Your brand of web-browser supports the more advanced method being used.
  • So in short it's likely most people playing my game (made using latest Twine and Sugarcube 2.11.0) won't be able to cheat by using the browser's Back and Forward nav buttons, but there's no guarantee this will be the case for all?
  • I just answered this. Browsers' own history buttons cannot work by default with SugarCube v2, because it does not use the browsers' history API. This is true for everyone, regardless of browser.
  • edited November 2016
    I'm sorry, but from what I could gather greyelf's post seemed to be suggesting that those with very old browsers may have active history navigation, so I was just checking.
Sign In or Register to comment.