3

Possible Duplicate:
Redirect parent window from an iframe action using JavaScript

I have a page with an iframe and in content of this iframe have a redirection on all window, how can I make this?

Tried:

window.location.href = 'logged.html';

I can get if the page is opened in a frame or a up?

 if(isiframe) window.top.location.href

--- solution ---

if($("#cboxOverlay", top.document).length > 0)
  if($("#cboxOverlay", top.document).css("display") != 'none')
    window.top.location.href = '{{ path('portada') }}';
Community
  • 1
  • 1
Ciro Vargas
  • 422
  • 1
  • 5
  • 16

3 Answers3

5

If they are in the same domain you may use

window.top.location.href = 'logged.html';

Otherwise there are a lot of similar threads in stackoverflow:

Cross Domain URL Access from Iframe using Javascript

Redirect parent window from an iframe action using JavaScript

Community
  • 1
  • 1
felipeclopes
  • 4,010
  • 2
  • 25
  • 35
2

window.top.location.href = "http://www.yourwebsite.com"; (but the IFrame and the top window must be on the same domain.

Samson
  • 2,801
  • 7
  • 37
  • 55
1

You need to redirect the "parent" ?

window.top.location = 'logged.html';
BLSully
  • 5,929
  • 1
  • 27
  • 43