diff --git a/src/gtk/utilities.c b/src/gtk/utilities.c index 87a263780..b822bf618 100644 --- a/src/gtk/utilities.c +++ b/src/gtk/utilities.c @@ -1320,11 +1320,34 @@ HtmlOutput(char *text, GtkWidget *gtkText, MOD_FONT *mf, char *anchor) for (q = safe_anchor; (q = strstr(q, "" - " window.onload = function () { window.location.hash = \"%s\"; }" - " ", - safe_anchor); +#ifdef WIN32 + // old windows webkit1 requires different attempt at scroll-to-anchor. + buf = g_strdup_printf("", safe_anchor); +#else + // the older location.hash method still works most reliably in modern webkit2. + buf = g_strdup_printf("", + safe_anchor); +#endif g_free(safe_anchor); XIPHOS_HTML_WRITE(html, buf, strlen(buf)); g_free(buf);