I have an MVC application that loads a video content package (from an external third-party vendor) into an iFrame. Under normal circumstances, when you make the call to this third party to retrieve the content, you pass it a ReturnURL parameter that tells the vendor's player where to redirect after the video content module has completed. Unfortunately, some new updated packages do not support the redirect. Instead of redirecting to the designated Redirect URL, upon the content module completing, it just redirects the iFrame to a page called "goodbye.htm" (which is still on the same domain as the third-party vendor).
Per recommendation, the vendor suggested we have a listener on the iFrame to detect when the iFrame src changes to this "goodbye.htm" page and then execute the code we need to redirect.
One of the problems we've encountered is getting the src of the iFrame AFTER it changes. Obviously just getting the src attribute from the iFrame only returns the original src, even after it changes. The other issue of course is that the domain of the goodbye.htm page is different than the domain of our application and the parent window, so it violates Same-Origin Policy.
Below is our JQuery function we're using to attempt the redirect.
$('.js__iframe-play').on('load', function () {
var src = $(this).attr("src");
if (src.includes("goodbye.htm")) {
const url = "/Learn/GetResults/" + $(this).data("class-id") + "?regid=" + $(this).data("registration-id");
console.log(url);
const newiframe = $(this).clone();
newiframe.attr("src", url);
$(this).after(newiframe);
$(this).remove();
}
})
Does anyone have any idea of how we can accomplish our goal?