So my initial issue is that whenever I click on a webpage (which loads an iFrame page within the page) and I interact with the iFrame, I have to click the back button multiple times in order to actually go back to the previous page I was on. I have found similar issues here which is pretty much what Im attempting, but I cannot use contentWindow.location.replace
because of CORS/security restrictions.
What is an alternative to work around the CORs/security restrictions? I just need help using something else than contentWindow or can I use contentWindow somehow? to be able to not have more history added to the queue so the back button is only needed to be hit once instead of 2-3 times right now.
I am using
$('#myIFrame').setAttribute('src', `newUrl`);
in my code. So I figured that could be my solution, just cant figure out the contentWindow part. As I think the fix is the link I provided above. browser back acts on nested iframe before the page itself - is there a way to avoid it?
I have tried using the method up above but when I run it locally it gives me this error:Unhandled Runtime Error TypeError: Cannot read properties of undefined (reading 'contentWindow')