0 votes
by (140 points)
I'm using Twine 2.2.1 on PC (locally installed, not browser based)

While I'm using Twine I have this super handy back button that returns me to the previous page I was on, however, that's missing when I output the story to an HTML file.

How do I add a back button to the HTML?

Yes, I know people can just use the browser's "back" button, but that's clunky and a poor design decision, imo.

Thanks in advance!  :)

2 Answers

0 votes
by (159k points)

Please use the Question Tags to state the name and full version number of the Story Format you are using, as answers can vary based on this information.

When you say "While I'm using Twine" I am going to assume you mean when you use the Test and Play options to run the (HTML) Preview of your story, and that by "I have this super handy back button" you mean the Undo (Harlowe) link or the History Backward (SugarCube) button that appears when necessary in those two story formats.

Harlowe: The Undo & Redo links should only appear in the left blank margin when their related actions are possible, this behaviour should be consisted whether you are using the Test or Play options to preview your story, or if you running the Story HTML file generated by the Publish to File option.

This story format doesn't include a built-in feature to hide the Undo & Redo links, but you can use CSS in your project's Story Stylesheet area or macros targeting the (newish) ?sidebar named hook to do this.

SugarCube: The History Backward & History Forward buttons (at the top of the left side-bar) will by default appear disabled, and will automatically enable when their related actions are possible. This functionallity should also be consistent across both preview and when running a generated story HTML file.

This story format includes a number of features that influence whether or not those buttons are displayed, like the Config.history.maxStates or Config.history.controls settings found in the Config API, and you can also use CSS you hide them.

Without seeing either a copy of your Story HTML file or knowing more about the contents of your project it is difficult to know why you're seeing the effect you are.

by (140 points)
edited by

EDIT: Wait, I think it might be working.  Please ignore this comment while I perform further testing.


Thanks for your response!  Unfortunately, I'm still a little confused.

Yes, you are correct, I have a back button during the TEST and PLAY modes of Twine.  I want that same feature in the HTML outpout to be available, without restrction.  I don't understand what you mean when you say it's only available "when the related actions are possible."  I want it to work like browsing the Internet, you should always be able to go back.  Is that possible?  Currently, that option is not available on any page, as far as I can tell.

I can share my HTML output if you think it would help.
by (159k points)

You still haven't stated which Story Format you are using!

> when the related actions are possible.

Harlowe: The Undo link will only appear in the left side-bar after the Reader has move off the first passage of your story, because undoing History requires that there is at least one Moment currently stored within the History system. The Redo link will only appear after the Reader has used the Undo link to move backwards in History, it will disappear again once the Reader has moved forward to another Passage (can be the same passage that they used the Undo in).

SugarCube: Unless the History Backward & History Forward buttons have been hidded then both button start off visible but disabled, and both buttons behave in a similar way to Harlowe's Undo & Redo links except in the button's case they become enabled/disabled instead of visible/hidden.

If you want me to have a look at your Story HTML file (your HTML output) then I am happy to do so.

by (140 points)
I’m sorry, I don’t know what story format I’m using or even how to find out.  Thank you for offering to help but everything is working as it should atm.
by (159k points)

The Twine 2 Wiki contains information about:
a. the different Story Formats supported by the Twine 2.x application,
b. the Story List page mentions the Format option which allows you determine which story formats are installed and which is your default for new projects.
c. the Setting a Story's Title page mentions how to use the Change Story Format option (found in the story menu of the story map) to see which story format your project is current using as well as letting you select a different story format.

It can be useful to read the documentation for the Twine 2.x application.

0 votes
by (6.2k points)

Please say what story format you're using. If Harlowe you can use:

(hisory)'s last

For example in a link:

(link: 'Back')[(goto: (history)'s last)]