get first parent of iframe javascript
- by baaroz
I have a iframe inside test.aspx,when the user click on a pay button inside the Iframe,the iframe redirct to check.aspx that has same iframe
if payment was success on first time, then window.parent.location.href==test.aspx
if payment was failed the iframe redirect again to check.aspx,so now the
window.parent.location.href==check.aspx
while the payement was failed the the iframe keep redirect to check.aspx and the parent location keep changing ,so for example if the client failed 3 time,inside check.aspx I need to do window.parent.parent.parent.location.href to get test.aspx redirect.
when the user payment was success ,then I want to redirect the test.aspx but I can't know
how much child iframe window he has!
I need something like
window.parent[0].location.href=success.aspx,so I will be able to redirect the first father window.
Thanks for any Help
Baaroz