Answers.Body: <p>One solution:</p>
  <p>A. Make it as a CSS/JS onLoad page event full screen overlay. See example that someone did at (though it's not for an epub it should work) ....<br />
  <a href="https://stackoverflow.com/questions/57636727/display-full-page-overlay-on-page-load">StackOverflow article</a></p>
  <p>B. Make that particular epub &quot;web links page&quot; as an independent page separate from the other storyline stuff leading up to it.</p>
  <p>C. Plus code to prevent forward swiping such as using <code>touch-action:none</code> and <code>overflow:hidden</code> functionality in CSS body/html.</p>
  <p>Other factors to consider:</p>
  <ol>
  <li>Epubs have a sidebar TOC and other secondary navigational links (such as guides); a user may encounter that 'frozen' page then resort to opening a sidebar TOC up and going to another page.</li>
  <li>Matching it all with your specific online market (eBook readers that allow javascript or only allow CSS code).</li>
  </ol>
  <p>Apple Books example epub is set in chapters etc. Yet in your instance perhaps breaking it into &quot;sections&quot; will allow you to point each section of the story into any one of multiple different directions you want the storyline to go.</p>
  <p><strong>Another viable option:</strong>
  <strong>Jump-to anchor link</strong></p>
  <p>Place this in page (use a new ID per each link) where you want the person to have the option to click and have the story go certain 'other' directions as a choice of options for the reader:</p>
  <pre><code>&lt;a href=&quot;#anchor1&quot;&gt;Pick Option A&lt;/a&gt;
  
  &lt;a href=&quot;#anchor2&quot;&gt;Pick Option B&lt;/a&gt;
  </code></pre>
  <p>Place these lower down in your page somewhere in the place where the new version of the story takes off into a new direction. The upper links will jump to:</p>
  <pre><code>&lt;a id=&quot;anchor1&quot;&gt;&lt;/a&gt;
  
  &lt;a id=&quot;anchor2&quot;&gt;&lt;/a&gt;
  </code></pre>
  <p>Or much better for compilation, jump to another page:</p>
  <pre><code>&lt;a href=&quot;../text/section-10.xhtml#anchor1&quot;&gt;&lt;/a&gt;
  
  &lt;a href=&quot;../text/section-12.xhtml#anchor2&quot;&gt;&lt;/a&gt;
  </code></pre>
  <p>Links explaining and showing the process:
  <a href="https://www.w3docs.com/tools/code-editor/1046" rel="nofollow noreferrer">w3Docs example</a></p>
  <p><a href="https://www.w3docs.com/snippets/html/how-to-create-an-anchor-link-to-jump-to-a-specific-part-of-a-page.html" rel="nofollow noreferrer">W3Docs explanation</a></p>
  <p>This would work ideally in a multi-section epub because in a multi-page epub you can keep the story line independent of the other pages for the remainder of the plot. When I say 'page' I merely mean the internal epub is setup with a whole string of html documents, none of which are visible to the end reader.
  Thus, setup the epub:</p>
  <pre><code>section-01.xhtml 
  
  section-02.xhtml 
  
  section-03.xhtml
  
  section-04.xhtml
  
  section-05.xhtml 
  
  section-06.xhtml 
  </code></pre>
  <p>Etc....</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-07T20:54:27.360Z
Answers.Text: Thanks for the suggestions. The only TOC that makes sense for these is one that just links to the start page... there are no "chapters" in the sense of a normal narrative. The links in the page to the other pages are the only navigational aids that make sense, as you don't read the book in a linear order (or even the majority of it, in any single read-through). I've tried in the past to use javascript in epubs, but it is a small subset of that available for webpages and I could never figure it out.
Answers.UserDisplayName: John O
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-22T02:31:50.700Z
Answers.Text: I added another option you might consider for your storyline sub-branches. It's in my detailed comments above, known as "Jump to anchor link".
Answers.UserDisplayName: granite
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-07T17:34:09.370Z
Answers.LastActivityDate: 2023-07-22T02:29:10.693Z
Answers.LastEditDate: 2023-07-22T02:29:10.693Z
Answers.UserDisplayName: granite
Body: <p>I've started working on a &quot;choose your own adventure&quot; book, for which it seems epub is well-suited. The choice at the end of a section are mere href links to the sections that are the consequences of those choices.</p>
  <p>However, especially on a phone, one can simply swipe to the next page rather than making a choice. This occurs accidentally, and since none of these are labeled with page numbers like in a real book, it can be easy to lose your place. Is there a way to disable swiping to the next page (xhtml file) in version 3? I'm not even entirely sure what this functionality might look like... maybe some xml weirdness in the metadata.opf file?</p>
  <p>I'm having alot of trouble even figuring out which keywords I need to search for, so any help is appreciated.</p>
  <p>epub format does include a &quot;linear='no'&quot; attribute in the spine (part of the metadata.opf file). It seems like (at one time) it might have been meant for a feature similar to this, in that it marks a xhtml file as being outside the linear scope of the book... you can't get to such a page by turning the pages at all.</p>
  <p>However, as implemented in Apple Books and other epub apps, it is unusable for a &quot;choose your own adventure&quot;-type book. In Apple Books, clicking/tapping on a (choice) link opens a sort of dialog with that page's content and a &quot;DONE&quot; button below the content. It seems they have purposed this feature for some sort of endnotes/footnotes/figures functionality. I think this is in error on their part, but it does not matter much whether I am correct... if they do it, then it's unusable for what I want to do (even if some other app gets it right).</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-07T20:51:00.267Z
Comments.Text: I finally found the linear="no" spine attribute, which sounds like what I might want. However, having tested it on iBooks (the first app I tend to test with, it's the quickest in that I don't have to airdrop it to my phone), and it sucks. Clicking on a link does flip through to that page, but pops up some sort of obnoxious hover window with a "done" button on it. Reading the spec, I can't help but think that Apple is just wrong in their interpretation. But wrong or right, it makes this particular feature unusable.
Comments.UserDisplayName: John O
Tags: <epub>
Title: Is it possible to disallow a reader to swipe to the next page in epub format?
UserDisplayName: John O
ThreadText: # Is it possible to disallow a reader to swipe to the next page in epub format?
  
  (Asked by: username_0 on 2023-07-06)
  
  I've started working on a "choose your own adventure" book, for which it seems epub is well-suited. The choice at the end of a section are mere href links to the sections that are the consequences of those choices.
  
  However, especially on a phone, one can simply swipe to the next page rather than making a choice. This occurs accidentally, and since none of these are labeled with page numbers like in a real book, it can be easy to lose your place. Is there a way to disable swiping to the next page (xhtml file) in version 3? I'm not even entirely sure what this functionality might look like... maybe some xml weirdness in the metadata.opf file?
  
  I'm having alot of trouble even figuring out which keywords I need to search for, so any help is appreciated.
  
  epub format does include a "linear='no'" attribute in the spine (part of the metadata.opf file). It seems like (at one time) it might have been meant for a feature similar to this, in that it marks a xhtml file as being outside the linear scope of the book... you can't get to such a page by turning the pages at all.
  
  However, as implemented in Apple Books and other epub apps, it is unusable for a "choose your own adventure"-type book. In Apple Books, clicking/tapping on a (choice) link opens a sort of dialog with that page's content and a "DONE" button below the content. It seems they have purposed this feature for some sort of endnotes/footnotes/figures functionality. I think this is in error on their part, but it does not matter much whether I am correct... if they do it, then it's unusable for what I want to do (even if some other app gets it right).
  
  **Tags:** epub
  
  > **Comments:**
  > **username_0**: I finally found the linear="no" spine attribute, which sounds like what I might want. However, having tested it on iBooks (the first app I tend to test with, it's the quickest in that I don't have to airdrop it to my phone), and it sucks. Clicking on a link does flip through to that page, but pops up some sort of obnoxious hover window with a "done" button on it. Reading the spec, I can't help but think that Apple is just wrong in their interpretation. But wrong or right, it makes this particular feature unusable.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-07-07. Score: 1
  
  One solution:
  A. Make it as a CSS/JS onLoad page event full screen overlay. See example that someone did at (though it's not for an epub it should work) ....
  StackOverflow article
  B. Make that particular epub "web links page" as an independent page separate from the other storyline stuff leading up to it.
  C. Plus code to prevent forward swiping such as using touch-action:none and overflow:hidden functionality in CSS body/html.
  Other factors to consider:
  
  Epubs have a sidebar TOC and other secondary navigational links (such as guides); a user may encounter that 'frozen' page then resort to opening a sidebar TOC up and going to another page.
  Matching it all with your specific online market (eBook readers that allow javascript or only allow CSS code).
  
  Apple Books example epub is set in chapters etc. Yet in your instance perhaps breaking it into "sections" will allow you to point each section of the story into any one of multiple different directions you want the storyline to go.
  Another viable option:
  Jump-to anchor link
  Place this in page (use a new ID per each link) where you want the person to have the option to click and have the story go certain 'other' directions as a choice of options for the reader:
  Pick Option A
  
  Pick Option B
  
  Place these lower down in your page somewhere in the place where the new version of the story takes off into a new direction. The upper links will jump to:
  
  
  
  
  Or much better for compilation, jump to another page:
  
  
  
  
  Links explaining and showing the process:
  w3Docs example
  W3Docs explanation
  This would work ideally in a multi-section epub because in a multi-page epub you can keep the story line independent of the other pages for the remainder of the plot. When I say 'page' I merely mean the internal epub is setup with a whole string of html documents, none of which are visible to the end reader.
  Thus, setup the epub:
  section-01.xhtml 
  
  section-02.xhtml 
  
  section-03.xhtml
  
  section-04.xhtml
  
  section-05.xhtml 
  
  section-06.xhtml 
  
  Etc....
  
  > **Comments:**
  > **username_0**: Thanks for the suggestions. The only TOC that makes sense for these is one that just links to the start page... there are no "chapters" in the sense of a normal narrative. The links in the page to the other pages are the only navigational aids that make sense, as you don't read the book in a linear order (or even the majority of it, in any single read-through). I've tried in the past to use javascript in epubs, but it is a small subset of that available for webpages and I could never figure it out.  
  > **username_1**: I added another option you might consider for your storyline sub-branches. It's in my detailed comments above, known as "Jump to anchor link".  
  
  ---
  
  