Question: Forcing a Redraw When Using the Back Button

12 views
Skip to first unread message

deletem3.com

unread,
Jun 18, 2007, 6:52:13 PM6/18/07
to Ruby on Rails: Spinoffs
Situation:

I have added a simple and slick effect when a link is clicked that
fades out the page, then loads the link. The page then fades in.
This effect was inspired by what is done at www.gucci.com.


Problem:

When the back button is used, the browser serves the page in it's
state when it was unloaded, which has the site #shell hidden.
Basically, the site doesn't show up.

The javascript that fades the page in has been run from both an init()
function before the </body>, and also on window.onload, with no
luck. The events are not fired.

What event can I observe that will fire after a page is presented from
going 'back', or is there a special way to force a redraw?

David Dashifen Kees

unread,
Jun 18, 2007, 7:41:46 PM6/18/07
to rubyonrail...@googlegroups.com
The only way I've solved this sort of problem is to store information in
a session variable on the server which can be used to control the state
of the web page. You can then, for example, run javascript at page load
without running it within the window.onload function. That is, just put
static javascript to be executed at the bottom of the page.

- Dash -

K. Heutmaker

unread,
Jun 18, 2007, 8:27:29 PM6/18/07
to Ruby on Rails: Spinoffs
I had the same issue with firefox. It had to do with firefox's DOM
caching function. The way to force firefox to not cache the DOM is to
attach an onunload() event to the body. The onunload() can be an empty
function, it just has to be there to force the DOM out of the cache.

deletem3.com

unread,
Jun 19, 2007, 10:30:54 AM6/19/07
to Ruby on Rails: Spinoffs
Thanks K. Heutmaker,

That was exactly what I was looking for!

- Matt

Reply all
Reply to author
Forward
0 new messages