I have a web application where we've embedded a payment form in an iframe (or the iframe is loaded by a script provided by the payment gateway). The problem is that at one point, the page loaded in the iframe tells the top window to redirect to a new url. We want that redirect to take place within the iframe itself. We could add some sandbox-parameters to the iframe, but then it wouldn't work at all instead (the redirect just doesn't happen then).
Is there a way to get the url that the iframe is trying to navigate to? Then we could prevent it from changing the top frame, and show it in the iframe instead.