Undefined When Navigating Back From iFrame

I have a requirement to load a webpage in my app and I have created a page with an iFrame that dynamically loads a URL from an API.

I can navigate to this page fine, and if I don’t click any link within the loaded webpage in the iFrame I can navigate back fine. If I click a link on the website, then hit the ionic back button, I get “Cannot GET /undefined”.

On the page that I am navigating back to, I am pulling the category buttons from an API as well.

Does anyone know why this might be happening?

Thanks a lot