2eecd47992bf6fcfee294854359117d81167459a
max
  Sat Sep 5 15:51:03 2026 -0700
hgc: show the trackDb iframeUrl frame with the item details, not above them

The iframe from the iframeUrl setting was written out before anything else on
the details page, which is unlike every other part of a details page. It now
appears just below the "View DNA for this feature" line, with the rest of the
details.

Rather than move each of the printIframe() calls, which all happen before the
position is known, printIframe() now only builds the html and a new
printPendingIframe() writes it out from the position-printing routines. That
covers bigBed, bigPsl and the generic click handler alike. The lorax details
page prints it immediately, since there the iframe is the page itself.

Also, a track with an iframeUrl but no url setting never showed its iframe at
all, refs #37595

diff --git src/hg/hgc/hgc.h src/hg/hgc/hgc.h
index abda4b2f4a1..251fde51f21 100644
--- src/hg/hgc/hgc.h
+++ src/hg/hgc/hgc.h
@@ -528,32 +528,38 @@
  * report how this SNP relates to any nearby genes. */
 
 void printSnp153Function(struct trackDb *tdb, struct snp125 *snp);
 /* If the user has selected a gene track for functional annotation,
  * report how this SNP relates to any nearby genes. */
 
 void doBigDbSnp(struct trackDb *tdb, char *rsId);
 /* Show details for bigDbSnp item. */
 
 void printAddWbr(char *text, int distance);
 /* a crazy hack for firefox/mozilla that is unable to break long words in tables
  * We need to add a <wbr> tag every x characters in the text to make text breakable.
  */
 
 void printIframe(struct trackDb *tdb, char *itemName);
-/* print an iframe with the URL specified in trackDb (iframeUrl), can have
- * the standard codes in it (like $$ for itemName, etc) */
+/* Prepare an iframe with the URL specified in trackDb (iframeUrl), can have
+ * the standard codes in it (like $$ for itemName, etc). The iframe is written
+ * out later, by printPendingIframe(). */
+
+void printPendingIframe();
+/* Write out the iframe queued up by printIframe(), if there is one. The
+ * position-printing routines call this, so the iframe ends up under the
+ * "View DNA" line with the other details. */
 
 char *getIdInUrl(struct trackDb *tdb, char *itemName);
 /* If we have an idInUrlSql tag, look up itemName in that, else just
  * return itemName. */
 
 // trackDb setting prefix for JS visualization scripts on details pages.
 // Format: detailsScript.<plotType>.<fieldName> <jsonConfig>
 // Parsed in both bigBedClick.c (to build JSON + load JS) and hgc.c (to skip fields from table).
 #define DETAILS_SCRIPT_PREFIX "detailsScript.*"
 
 void printFieldLabel(char *entry);
 /* print the field label, the first column in the table, as a <td>. Allow a
  * longer description after a |-char, as some fields are not easy to
  * understand. */