2026-11-23 05:17 UTC

View Issue Details [ Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002928NetSurf[All Projects] Generalpublic2026-11-21 08:52
ReporterJeremy Visser 
Assigned To 
SeverityminorReproducibilityalways 
StatusnewResolutionopen 
PlatformTested on GTK and FramebufferOSLinux (Fedora 45, Rocknix)OS Version
Product Version3.11 
Target VersionFixed in Version 
Summary0002928: browser_window: back history breaks on meta redirect
DescriptionIf a website uses a meta http-equiv redirect, it is impossible to return to the redirection target page with the Back button.

This is because browser_window_refresh() sets the BW_NAVIGATE_HISTORY flag with the opposite logic to what is needed.

BW_NAVIGATE_HISTORY tells the browser to create a history entry, i.e. one that can be returned to with the Back button. A meta redirect that sends you to a different page should obviously have a history entry created for that target.

However, what browser_window_refresh() ends up doing is only setting BW_NAVIGATE_HISTORY when the meta redirect target is the same URL, which is completely the opposite of what we want.
Steps To Reproduce  1. Navigate to refresh.html, which contains:

         <meta http-equiv="refresh" content="0;url=target.html">

  2. target.html loads, which contains:

         <a href="other.html>other.html</a>

  3. Click link (other.html), and press Back

  4. - Expectation: back to target.html
     - Reality: back to refresh.html

       - If refresh.html is random (i.e. subsequently redirects to
         target2.html), it will be impossible to go back to target.html

       - If refresh.html is static (e.g. in a reproduction case), you
         will still end up on the intended destination (after an extra
         page load). But in this case, it is incorrect to conclude that
         you have failed to reproduce the bug; rather, you have failed to
         reproduce the *test*.

Reproduced on git commit daf380d279b2818e3b1f226bc5ec00dfa25bff8c.
Additional InformationA suggested fix is attached, although feel free to fix it differently if you prefer, or if I've made a mistake.
TagsNo tags attached.
Fixed in CI build #
Reported in CI build #
URL of problem page
Attached Files
  • patch file icon fix-meta-redirect.patch (2,114 bytes) 2026-11-21 08:52 -
    From 303c3cc534e3f606528433b176d7133d46a5200f Mon Sep 17 00:00:00 2001
    From: Jeremy Visser <jeremy.visser@gmail.com>
    Date: Wed, 4 Nov 2026 13:04:37 +1100
    Subject: browser_window: fix back history for meta redirect
    
    This fixes a bug which otherwise causes it to be impossible to return to
    the target of a meta http-equiv redirect after navigating once, if the
    redirect is itself (intentionally) random.
    
    At time of writing, https://wiby.me/ has a "surprise me!" link
    (https://wiby.me/surprise/) which can reproduce the problem.
    
    The underlying reproduction steps are:
    
      1. Navigate to refresh.html, which contains:
    
             <meta http-equiv="refresh" content="0;url=target.html">
    
      2. target.html loads, which contains:
    
             <a href="other.html>other.html</a>
    
      3. Click link (other.html), and press Back
    
      4. - Expectation: back to target.html
         - Reality:     back to refresh.html
           - If refresh.html is random (i.e. subsequently redirects to
             target2.html), it will be impossible to go back to target.html
    
    BW_NAVIGATE_HISTORY is used to indicate whether to create a history
    entry for this particular navigation.
    
    For example, clicking Back/Forward is itself a form of navigation that should
    *not* cause a new history entry.
    
    A meta http-equiv refresh that redirects to the same page repeatedly should
    also *not* cause a history entry
    
    But a http-equiv redirect to a *different* page *should* cause a history
    entry, since it's a page the user will actually land on.
    ---
     desktop/browser_window.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/desktop/browser_window.c b/desktop/browser_window.c
    index 226741be5..5c108a539 100644
    --- a/desktop/browser_window.c
    +++ b/desktop/browser_window.c
    @@ -638,7 +638,7 @@ static void browser_window_refresh(void *p)
     	content_invalidate_reuse_data(bw->current_content);
     
     	url = hlcache_handle_get_url(bw->current_content);
    -	if ((url == NULL) || (nsurl_compare(url, refresh, NSURL_COMPLETE))) {
    +	if ((url == NULL) || (!nsurl_compare(url, refresh, NSURL_COMPLETE))) {
     		flags |= BW_NAVIGATE_HISTORY;
     	}
     
    -- 
    cgit v1.2.3
    
    
    patch file icon fix-meta-redirect.patch (2,114 bytes) 2026-11-21 08:52 +

-Relationships
+Relationships

-Notes
There are no notes attached to this issue.
+Notes

-Issue History
Date Modified Username Field Change
2026-11-21 08:52 Jeremy Visser New Issue
2026-11-21 08:52 Jeremy Visser File Added: fix-meta-redirect.patch
+Issue History