0

I am using rails 4.1.2. I need to use to redirect a parent window from an iframe. I use a redirect url in the iframe to logout of the application. The view corresponding to the logout action in the controller contains the following code.

$( document ).ready(function() {
    window.top.location.href = '<%= @redirect_url %>';
});

The code above works fine in chrome, but doesn't work in firefox browser. Could anybody help me with it?

Thanks for your valuable time.

Rob M.
  • 35,491
  • 6
  • 51
  • 50

1 Answers1

0

You could try:

$( document ).ready(function() {
    window.location.href = '<%= @redirect_url %>';
});

Or:

$( document ).ready(function() {
    window.location.replace('<%= @redirect_url %>');
});

Copied from answer: How can I make a redirect page using jQuery?

Community
  • 1
  • 1
annemartijn
  • 1,538
  • 1
  • 23
  • 45
  • thanks ur response, that's not working . I found one I am not getting the alert message in script tag also. – Madhu Rise May 21 '15 at 17:04
  • The console in your browser will tell you if there are any syntax errors. Since Javascript is script, it will also stop executing if there's an exception somewhere (that's not caught). – annemartijn May 21 '15 at 17:07
  • Yeah, i Observe red once again, there is no error message console. One thing its working fine in chrome browser. I think its rails issue – Madhu Rise May 22 '15 at 04:39