This repository was archived by the owner on Aug 5, 2025. It is now read-only.
Implement backward and forward navigation options to iframed window (1.5 - accidentally closed) #191
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: This PR builds on the merged and soon-to-be-reverted PR #181 and removes the
set_iframe_scrfunction andloadedarchitecture so that the app navigates backward and forward seamlessly.Overview of changes
This PR adds backward and forward navigation options to iframed window. Because this sort of behavior isn't normally possible within the natural constraints of the History API since the history of the iframed window and that of its containing parent window operate together, I opted to manually track the history of the iframed window in two arrays—
history_bwdandhistory_fwd.Implementation/test cases & detailed steps for each
When any path is manually entered into the iframe's simulated address field… (expand to see details)
pathis appended tohistory_bwdhistory_fwdis resetpathis naturally set to the entered path (current functionality)When the "back" button is clicked… (expand to see details)
pathis prepended tohistory_fwdhistory_bwdis sliced offpath) replaces the currentpathWhen the "forward" button is clicked… (expand to see details)
pathis appended tohistory_bwdhistory_fwdis sliced offpath) replaces the currentpathWhen any link within the iframe is clicked, it is picked up by
handle_messagewhich then falls back to using thenav_tofunction for handling and tracking the history accordingly, effectively… (expand to see details)pathis appended tohistory_bwdhistory_fwdis resetpathis naturally set to the entered path (current functionality)Notes
reset_historyfunction that resets the history, which I trigger in thetryclause withinafterNavigate.Testing
This can be tested/demoed effectively using any of the routing examples:
Screen recording
Screen.Recording.2023-01-23.at.11.51.15.AM.mov