Rails redirect_to :back in Internet Explorer

Today I realized that the rails command redirect_to :back does not work in Internet Explorer because redirect_to :back depends on the HTTP_REFERER http header, which IE does not send. I was capturing an onclick event with jQuery and was able to sending along the current URL as a query string, which provided an easy way around this limitation.

In the view:

        window.location.href = 'theDestinationPage/?current_url=' + document.location ;

In the controller:

def myAction
    redirect_to params[:current_url]
This entry was posted in rails. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment

  1. Posted April 2, 2009 at 8:32 am | Permalink

    Cool! It did help me. thanks! :D

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>