2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Airshow
0

LoveP,

function hardReload(fromServer) {
  // Perform a hard reload of the document.
  // This kind of reload resets form elements to their default values
  // Call with hardReload(false) to retreive from browser cache (if available)
  // Call with hardReload(true) to force the page to be re-served by the server
  fromServer = (!fromServer) ? false : true;
  location.reload(fromServer);
}

function softReload() {
  // Perform a soft reload of the document.
  // This kind of reload does not reset form values 
  // and is useful when a user has entered data into a form and you don't want to erase it.
  // Unfortunately, some browsers (notably some versions if IE) will perform a hard reload.
  history.go(0);
}

history.go(0) is probably not used as much as history.go(-1) , which (when it works) soft-reloads the previous page, emulating the browser's back button.

Above, I wrapped the statements up as functions for illustration. You can use location.reload(true) , location.reload(false) and history.go([I]N[/I]) anywhere in your code as appropriate.

Airshow

Edited by Airshow: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.