How to deal with iframes affecting navigtion?
Question
Application Type
Reactive
Service Studio Version
11.11.11 (Build 47088)
Platform Version
11.8.4 (Build 29614)

Our Reactive app has a cross-domain iframe embedded in a Screen. The iframe is wrapped in an If node and is rendered when set to true after a small delay. I noticed that once the iframe is loaded, a new browser history entry is added of the current page. This causes the Back button and Previous Screen destination to keep navigating to the current page.

We do have a UI back button inside our screen that we could change to call history.go(-2) once the iframe is loaded, but I don't think we can do anything to override the actual browser Back button.

What would be a good way to handle this so our back button functionality still works?

We learned that any navigation within the iframe also creates browser history in the parent. The initial history entry was caused by our src URL doing a redirect. But since we also have other links in the page we want to iframe, we can't use the history.go(-2) in my initial solution.

Our new solution is to make our iframed application only navigate with replaceState on the pages we display to the user when it detects it's inside an iframe.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.