bones225
bones225

Reputation: 1728

Redirect parent window from iFrame not working in Safari

My site is mysite.com. I am iframing othersite.com and having my user complete a task on it.

I can check via API if my user has completed the task on othersite.com. However, I'd like to figure out another way to figure out when the user has completed the task so that I can navigate to the next page on mysite.com.

When the user completes the task on othersite.com, othersite.com redirects them to mysite.com/complete/ -- inside the iframe. I've been taking advantage of this by putting the following JS code on mysite.com/complete/

window.top.location == 'mysite.com/next';

So that the parent window is automatically pushed to the next page. I've got this working on Chrome, but on Safari it redirects the inner iframe, not the parent.

What might be causing the difference between Chrome and Safari? Is there a better way to accomplish this goal?

Note: I've seen this this answer, so it seems like there's something happening with the window.top.location function in Safari, but even trying that fix I'm having trouble escaping the inner iframe.

Upvotes: 2

Views: 1263

Answers (0)

Related Questions