Closed Bug 718264 Opened 12 years ago Closed 8 years ago

Page reload after anchor navigation and scrolling: unpleasant jumps (goes to the anchor, not to the position scrolled to)

Categories

(Core :: DOM: Navigation, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 842853

People

(Reporter: kxroberto, Unassigned)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20111221 Firefox/9.0.1 SeaMonkey/2.6.1
Build ID: 20111221001913

Steps to reproduce:

* navigate to URL with anchor  http://somewhere/page#anchor; a longer page.
* scroll a little to another position
* Page content changes in background
* Press F5 for Reload




Actual results:

After page reload the browser jumps always back to the anchor position - amnesia about the scroll position.

( This jumpy behavior is not, when the current URL has no anchor:  http://somewhere/page )



Expected results:

After reload Moz should always use the smart reload algorithm (like with non-anchor URL) to preserve the current scroll position - like IE and Chrome do for good reason.
The user 99.999% has forgotten/no knowledge that he navigated to a anchor (perhaps addition) and scrolled when he wants to update page.  Navigating to an anchor has in the view of the user no higher prio than manuall scrolling - they are coequal means.

The problem is unpleasant both for following pages during page develoment, and for following pages with some dynamic/updating (sub-)content. 

(Problem is same with Firefox when I remember right)
WORKSFORME
Tested url: http://www.fcenter.ru/online.shtml?articles/hardware/videos/32727#03
Tested builds:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20111221 Firefox/9.0.1 SeaMonkey/2.6.1
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0a1) Gecko/20120114 Firefox/12.0a1 SeaMonkey/2.9a1
Works for me:
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.20pre) Gecko/20110606 Lightning/1.0b2pre SeaMonkey/2.0.15pre
Works for me:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0a1) Gecko/20120115 Firefox/12.0a1 SeaMonkey/2.9a1

Try restarting SeaMonkey in Safe Mode: Go Help->Restart with Addons Disabled.
The "Restart with Addons Disabled" did not solve.

Strange is that with most pages on the net (as your example) the problem is not.
But I pinned it down to a very simple example - though I cannot say what it is exactly. 

Find attached test_anchor.html and empty.css

I tried with different DTDs and charsets too - no symptom change.

The bug is with Firefox too. But not with Chrome and IE.

Strange: As soon as empty.css is not linked in the html file, then the problem disappears.  
The css can be non-empty as well to reproduce the problem. Just tried to pin down the problem. As soon as a css file is linked the problem is there.
Confirming on both SeaMonkey and Firefox
Mozilla/5.0 (Windows NT 5.1; rv:12.0a1) Gecko/20120117 Firefox/12.0a1
Mozilla/5.0 (Windows NT 5.1; rv:12.0a1) Gecko/20120114 Firefox/12.0a1 SeaMonkey/2.9a1
(the html code is green on W3C Validator)
========= test_anchor.html =========

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>TEST</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="empty.css" type="text/css">

</head>
<body>

<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>
<p>before the anchor</p>


<p><a name="anchor"></a>ANCHOR</p>


<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>
<p>after the anchor</p>

</body>
</html>
found: as soon as an EXISTING .js file (can be empty) is loaded AFTER the css link, the problem disapears. 
(Linking a favicon does not "solve" the same way)
(even a empty inline javascript yet "solves" again)

:::


<head>
<title>TEST</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">

<link rel="stylesheet" href="empty.css" type="text/css">
<script language="javascript" type="text/javascript" src="empty.js"></script>

</head>
...


:::



<head>
<title>TEST</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">

<link rel="stylesheet" href="empty.css" type="text/css">
<script language="javascript" type="text/javascript">
</script>
 
</head>
Attachment #589451 - Attachment mime type: text/plain → text/html
/With no .CSS/, if you are at the very top of the page ("line 1", if you will), then a page refresh /will/ jump to ANCHOR.

Anywhere else other then at the very top of the page, then a page refresh maintains its position.


With the .CSS, a page refresh always jumps to ANCHOR.
OS: Windows XP → All
Product: SeaMonkey → Core
QA Contact: general → general
Hardware: x86 → All
Version: SeaMonkey 2.6 Branch → Trunk
Status: UNCONFIRMED → NEW
Ever confirmed: true
Component: General → Document Navigation
Summary: Page reload after anchor navigation and scrolling: unpleasant jumps → Page reload after anchor navigation and scrolling: unpleasant jumps (goes to the anchor, not to the position scrolled to)
Dupe of bug 842853?
(In reply to YF (Yang) from comment #9)
> Dupe of bug 842853?
Looks like so, at least I can't reproduce the issue anymore
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: