title: Jquery-ui dialog iframe + back button = disaster
body: <p>I don't know where to begin this one and the chances of getting a fix are probably 1 in 1,000,000 but here is the problem:  I have elements on a page that have classes of "Edit" or "Add".  They also each have a custom attribute called "edit" or "add" which I use to pass an ID.  When you click one of these, I use the following functions to open a jquery-ui dialog with an iframe with the src based on the ID mentioned above.  The problem is, say I'm on PAGE1 and I click EDIT123.  I then go to PAGE2 and click EDIT234.  Everything works normally.  BUT, when I hit the back button, which takes me back to PAGE1, no matter what I click it always opens EDIT123.  The weird thing is if you set breakpoints you can clearly see that the URL and corresponding iframesrc are correct.  It always opens the LAST thing you clicked on PAGE1, regardless of how many things it correctly opened when PAGE1 was initially loaded or when you were on PAGE2.</p>
  
  <p><strong>EDIT:</strong> I forgot to mention, if you hit back and then click an ADD button, it STILL opens the last EDIT page...</p>
  
  <pre><code>&lt;script language="javascript" type="text/javascript"&gt;
  
  $(document).ready(function () {
  
  
      var date = new Date();
  
      //catch a click on an item with the class "edit" open modal div.
      $('.Edit').live('click', function () {
          var thing = $(this).attr('edit')
          var date = new Date();
          var url = 'edit/' + thing + '.aspx?appid=' + $('.lblAppID').html() + '&amp;value=' + $(this).attr('entityid') + '&amp;' + date.getTime();
          var iframesrc = $('&lt;iframe width="100%" height="100%" marginwidth="0" marginheight="0" frameborder="0" src="' + url + '" scrolling="auto" title="Dialog Title"&gt;&lt;/iframe&gt;');
          $('#modalDiv').dialog("option", "title", "Loading...").empty().append(iframesrc).dialog('open');
          return false;
      });
  
  
      //catch a click on an item with the class "add" open modal div.
      $('.add').live('click', function () {
          var thing = $(this).attr('add')
          var url = 'add/' + thing + '.aspx?appid=' + $('.lblAppID').html() + '&amp;' + date.getTime();
          var iframesrc = $('&lt;iframe width="100%" height="100%" marginwidth="0" marginheight="0" frameborder="0" src="' + url + '" scrolling="auto" title="Dialog Title"&gt;&lt;/iframe&gt;');
          $('#modalDiv').dialog("option", "title", "Loading...").empty().append(iframesrc).dialog('open');
          iframesrc.history.next();
          return false;
      });
  
  });
  &lt;/script&gt;
  
  &lt;div id="modalDiv"&gt;&lt;/div&gt;
  </code></pre>
  
  <p><strong>EDIT2</strong> I just set the following code in my master page codebehind to disable all caching.  When I click back it is noticable that it actually reloads everything... but the issue still persists.  :batshitcrazy:</p>
  
  <pre><code>    HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1))
      HttpContext.Current.Response.Cache.SetValidUntilExpires(False)
      HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches)
      HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache)
      HttpContext.Current.Response.Cache.SetNoStore()
  </code></pre>
  
  <p><strong>EDIT3</strong> Also added this to the main js file</p>
  
  <pre><code>$(window).bind('unload', function () {
      jQuery.cache = {};
      alert('clearing cache');
  });
  </code></pre>
  
  <p>Each time I navigate away from a page, hitting back or forward, I do get the alert.  Issue still persists.</p>