131e5eb763756beb50f67554ecc9c16d7640a948
angie
  Tue Sep 17 09:33:28 2013 -0700
Handle IE's unique behavior of window.location.replace when the newURL (including stuff after '?') is the same as the current URL.
fixes #11443

diff --git src/hg/lib/jsHelper.c src/hg/lib/jsHelper.c
index 07f834f..9b37c25 100644
--- src/hg/lib/jsHelper.c
+++ src/hg/lib/jsHelper.c
@@ -485,32 +485,42 @@
 // http://siphon9.net/loune/2009/07/detecting-the-back-or-refresh-button-click/
 // Yes, I know this along with every other inline <script> here belongs in a .js module
 {
 printf("<script>\n"
        "document.write(\"<form style='display: none'><input name='__detectback' id='__detectback' "
        "value=''></form>\");\n"
        "function checkPageBackOrRefresh() {\n"
        "  if (document.getElementById('__detectback').value) {\n"
        "    return true;\n"
        "  } else {\n"
        "    document.getElementById('__detectback').value = 'been here';\n"
        "    return false;\n"
        "  }\n"
        "}\n"
        "window.onload = function() { "
-       "  if (checkPageBackOrRefresh()) { window.location.replace('%s?%s'); } };\n"
-       "</script>\n", cgiScriptName(), cartSidUrlString(cart));
+       "  if (checkPageBackOrRefresh()) { \n"
+       "    if (window.location.search == '?%s') { \n"
+	      // We already have the hgsid-only URL that we want, reload it.
+	      // (necessary for IE because IE doesn't reload on replace,
+	      //  unless window.location and/or window.search changes)
+       "      window.location.reload(true);\n"
+       "    } else { \n"
+       "      window.location.replace('%s?%s');\n"
+       "    } \n"
+       "  } "
+       "};\n"
+       "</script>\n", cartSidUrlString(cart), cgiScriptName(), cartSidUrlString(cart));
 }
 
 static struct jsonElement *newJsonElement(jsonElementType type)
 // generic constructor for a jsonElement; callers fill in the appropriate value
 {
 struct jsonElement *ele;
 AllocVar(ele);
 ele->type = type;
 return ele;
 }
 
 struct jsonElement *newJsonString(char *str)
 {
 struct jsonElement *ele = newJsonElement(jsonString);
 ele->val.jeString = cloneString(str);