bookreader icon indicating copy to clipboard operation
bookreader copied to clipboard

Fix: Ensure mode=2up persists in iframe

Open Ankush1oo8 opened this issue 9 months ago • 1 comments

** Fix for Issue #1311**

This PR ensures that the mode=2up setting is properly respected when the BookReader is embedded inside an iframe. Previously, the reader defaulted to 1up mode despite the URL containing mode=2up.

** Changes Made:**

✅ Updated BookReader.js to ensure that:

  • The mode is retrieved from the URL (mode=2up), or from localStorage if previously set.
  • Embedded readers (inside iframes) respect the mode=2up parameter.
  • Mode switching (1up, 2up, thumb) persists after refresh.
  • Navigation controls correctly update localStorage for mode preference.

🛠 Testing Done:

  • ✅ Opened BookReader inside an iframe → Confirmed it starts in 2up mode.
  • ✅ Changed modes (1up, 2up, thumb) → Refreshed page, mode persisted.
  • ✅ Verified fullscreen and non-embedded modes remain unaffected.
  • ✅ Tested in Chrome, Firefox, and Edge to confirm cross-browser compatibility.

** Steps to Reproduce & Test:**

  1. Embed the reader using:
    <iframe src="https://archive.org/embed/YOUR_ITEM_ID/page/0/mode/2up?ui=embed" width="800" height="600"></iframe>
    
  2. Load in a browser → It should start in 2up mode.
  3. Switch to 1up mode → Refresh the page → It should remember the last selected mode.
  4. Test outside an iframe (normal mode) → No unintended changes.

✅ Expected Outcome:

  • BookReader inside an iframe starts in 2up mode.
  • User-selected mode persists after page refresh.
  • No impact on normal (non-iframe) usage.

Ankush1oo8 avatar Mar 08 '25 19:03 Ankush1oo8

can any one check it

Ankush1oo8 avatar Mar 10 '25 21:03 Ankush1oo8