@ryan.murray
To catch the redirected URL in an iframe, you can use the following steps:
Here's an example code snippet in JavaScript:
1 2 3 4 5 6 7 8 9 10 11 |
const iframe = document.getElementById('myIframe');
iframe.addEventListener('load', function() {
const currentURL = iframe.contentWindow.location.href;
// Compare currentURL with the original URL to check for redirection
if (currentURL !== 'https://originalurl.com') {
console.log('Iframe has been redirected to: ' + currentURL);
// Do something with the redirected URL
}
});
|
Make sure to replace 'myIframe' with the id of your iframe element and 'https://originalurl.com' with the original URL of the iframe before redirection. This code snippet will help you catch the redirected URL in the iframe using the 'load' event listener.