Sugarcube Browser Tab Name Editing?

Hello all,

Not sure if this has been asked before (I tried looking first), but I was wondering if I could modify the Sugarcube (2.34.1) browser tab name beyond the ‘StoryDisplayTitle’ passage. Basically, my game uses the story title to display the current character location on the map, but I’d like the browser tab to display the name of the game itself instead of the story title. Is this doable? I’m using Twine 2.3.14.

Since the StoryDisplayTitle special passage will try to update the title shown in the browser’s tab every time a new passage loads, this means that you’ll need to overwrite that update with whatever you want instead upon each passage being loaded. Putting this code in your JavaScript section should do the trick:

$(document).on(":passageend", function () {
setTimeout(function () { $("title").text("XYZ"); }, 250);

The first three lines make sure that the title is updated after every passage finishes displaying, and the last line does it once, 250ms after the program starts, since the timing for the first passage works a bit differently. Simply replace “XYZ” on the 2nd and 4th lines with whatever it is that you want to appear in the browser’s tab instead.

Enjoy! :slight_smile:

1 Like

It worked, thank you so much for your help!