bookreader
bookreader copied to clipboard
Fix: Ensure mode=2up persists in iframe
** 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 fromlocalStorageif previously set. - Embedded readers (inside iframes) respect the
mode=2upparameter. - Mode switching (
1up,2up,thumb) persists after refresh. - Navigation controls correctly update
localStoragefor mode preference.
🛠 Testing Done:
- ✅ Opened BookReader inside an iframe → Confirmed it starts in
2upmode. - ✅ 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:**
- Embed the reader using:
<iframe src="https://archive.org/embed/YOUR_ITEM_ID/page/0/mode/2up?ui=embed" width="800" height="600"></iframe> - Load in a browser → It should start in
2upmode. - Switch to
1upmode → Refresh the page → It should remember the last selected mode. - Test outside an iframe (normal mode) → No unintended changes.
✅ Expected Outcome:
- BookReader inside an iframe starts in
2upmode. - User-selected mode persists after page refresh.
- No impact on normal (non-iframe) usage.
can any one check it