Sometimes a JavaScript method may change the context of the current page making some of the content obsolete.  An example is if due to a user action you change the value of a cookie.  Say you have a dialog to launch a user settings page.  On this page you can select to show/not show C# code.  Once this dialog is selected and closed you will want to re-draw any open pages this may effect.  Partial page updates are one of the greatest advantage of AJAX. 

for example:
document.cookie = ‘ShowC#Files=true;path=/’

  • If the changed cookie value does not require a server post back then 
    window.location.reload( false );
  • If the changed cookie value is used by Server Side code to generate the page you will require a server post back thus passing true to method 
    window.location.reload( true);

Firefox has issues refreshing the page using JavaScript window.location.reload().  A work around is to use document.location.reload().

Leave a Reply