[ 2 posts ]

David Rueter

  • Username: drueter
  • Joined: Tue Oct 13, 2009 6:40 pm
  • Posts: 14
  • Offline
  • Profile

Re-enable events upon re-vist page?

Post Posted: Wed Jan 27, 2010 3:22 pm
+0-
What is the best way to re-enable events when a page is re-visited via the browser's Back button?

More specifically, I have a simple page consisting of something like following:

<html>
<body>
some stuff...
<script src="http://yui.yahooapis.com/3.0.0/build/yui/yui-min.js"></script>
<script src="/JS_688897D4C4744EE0A13535002B109D06.js"></script>
</body>
</html>

The YUI sandbox is declared in the JS_xxx file. That file has some in-line code that sets up event handlers for elements on the page.

It all works fine--the first time the page is displayed. But when a Back-button click re-displays the page, the in-line JS code is not executed.

I could hook to <body onload="">, but I'd like the page to render first (without waiting for the external files to be pulled down).

What is the right way to make sure that my initialization code in JS_xxxx is reliably called after the page is rendered, even on a re-visit to the page?

David Rueter

  • Username: drueter
  • Joined: Tue Oct 13, 2009 6:40 pm
  • Posts: 14
  • Offline
  • Profile

Re: Re-enable events upon re-vist page?

Post Posted: Wed Jan 27, 2010 10:00 pm
+0-
So I learned that setting cache-control=no-store instead of no-cache does cause scripts to be executed on reload of the page when the back button is clicked.

I'm still curious though about the best way to execute YUI code when the page is loaded: onload, inline javascript statements, or something else...
  [ 2 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
cron