Hi! I’d like to create a link that opens multiple passages (each in its own window) at once. Is this possible in twine? Thank you!
Twine Version: 2.4.1
Story Format: Sugarcube 2.36.1
Hi! I’d like to create a link that opens multiple passages (each in its own window) at once. Is this possible in twine? Thank you!
Twine Version: 2.4.1
Story Format: Sugarcube 2.36.1
In 25 years of navigating internet I’ve never seen a unique link opening multiple windows by itself. The best I can think of is to send the reader to a new passage and open a Dialog
at the same time, however it’s not two independent windows.
Maybe someone more knowledgeable will step in and correct me?
A couple of clarification questions:
When you say “in its own window” do you mean:
a. open each “passage” within its own Window/Instance of your favourite web-browser.
b. open each “passage” within its own tab within the current web-browser Window / Instance.
c. open each “passage” within its own “dialog”, all associated with the current web-page.
d. open each “passage” within its own distinct area of the “current” Passage being shown.
e. open each “passage” within its own pre-defined area of the web-page…
f. something else entirely.
If you meant either A or B then, why do you need each of those “passages” opened that way?
eg. what are you trying to achieve by opening “passages” that way.
Thank you for your response! I’m aiming to a/b. open each “passage” within its own window in the current web-browser instance. It’s for an art project that is a variation of choose-your-own-adventure. Instead of choosing a direction, the user is presented with a number of simultaneous paths to go down
A Twine Story HTML file is a single-page web-application.
None of the current Story Formats have built-in support for communicating between web-browser Windows/Tabs. So if you programmatically opened multiple Windows/Tabs, each with their own instance of your project open within it, there would be no built-in way for them to communicate with each other. Thus it would be the equivalent of the end-user just opening multiple copies of your project.
But to answer your question…
The HTML <a>
Anchor element has the ability to open its target HTML file within another tab, by setting its target attribute to _blank.
Please select one of the following links...
<a href="adventure.html" target="_blank">Library</a>
<a href="adventure.html" target="_blank">Study</a>
And if you use the a fragment URL in the anchor’s href
attribute like so…
Please select one of the following links...
<a href="adventure.html#library" target="_blank">Library</a>
<a href="adventure.html#study" target="_blank">Study</a>
…then it is possible to use JavaScript at project start-up to process the tab’s window.location property to extract the fragment value from the URL, and change which is the 1st Passage to be shown within that tab.
Unfortunately I don’t have an example of the required JavaScript handy, but someone else might.