# RJSdisplayed when using back button?

**URL:** <https://www.ruby-forum.com/t/rjsdisplayed-when-using-back-button/140711>\
**Category:** Rails\
**Created:** [June 17, 2008, 8:26pm UTC](https://www.ruby-forum.com/t/rjsdisplayed-when-using-back-button/140711 "2008-06-17T20:26:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andywatts](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d78d45/32.png) [@andywatts](https://www.ruby-forum.com/u/andywatts)\
**Post date:** [June 17, 2008, 8:26pm UTC](https://www.ruby-forum.com/t/rjsdisplayed-when-using-back-button/140711/1 "2008-06-17T20:26:56Z")

</div>

Given an action that responds to regular requests and XHR requests.

Eg.  
if request.xhr? then  
render :update do |page| page.visual… end  
elsif !request.xhr? then  
render :template =\> …  
end

Using the browser back button to return to this page, firefox 2 will  
‘sometimes’ display the raw javascript of the last XHR response and not  
the base page.  
Oddly, it doesn’t happen if going back one page, but happens when going  
back several pages.

Maybe a browser issue, but wondering if anyone has any suggestions?

Many Thanks  
Andy W.
