b3fa58bc96f662c6b997ee8003e2cb15a16b68ab
max
  Wed Jan 31 08:05:52 2024 -0800
reload hgTracksif the pix variable is not set, refs #32925

diff --git src/hg/js/utils.js src/hg/js/utils.js
index a0df8f9..11acfdd 100644
--- src/hg/js/utils.js
+++ src/hg/js/utils.js
@@ -2003,30 +2003,44 @@
 
 function setCheckboxList(list, value)
 { // set value of all checkboxes in semicolon delimited list
     var names = list.split(";");
     for (var i=0; i < names.length; i++) {
         $("input[name='" + names[i] + "']").attr('checked', value);
     }
 }
 
 function calculateHgTracksWidth()
 {
 // return appropriate width for hgTracks image given users current window width
     return $(window).width() - 20;
 }
 
+function addPixAndReloadPage()
+/* users who do not come in from hgGateway have no pix variable in the URL nor the cart.
+ * This is a rare case, and the solution is brute force: if it happens, set pix, then reload the entire page.
+ * This will only happen once to these users, as afterwards the cookie is set. */
+{
+    var winWidth = calculateHgTracksWidth();
+    var myUrl = window.location.href;
+    var sep = '?';
+    if (myUrl.indexOf('?'!==-1))
+        sep = '&';
+    var newUrl = myUrl+sep+"pix="+winWidth;
+    window.location.href = newUrl;
+}
+
 function hgTracksSetWidth()
 {
     var winWidth = calculateHgTracksWidth();
     if ($("#imgTbl").length === 0) {
         // XXXX what's this code for?
         $("#TrackForm").append('<input type="hidden" name="pix" value="' + winWidth + '"/>');
         //$("#TrackForm").submit();
     } else {
         $("input[name=pix]").val(winWidth);
     }
 }
 
 function filterByMaxHeight(multiSel)
 {   // Setting a max height to scroll dropdownchecklists but
     // multiSel is hidden when this is done, so it's position and height must be estimated.