X
Tap here to go to the mobile version of the site.

Support Forum

Anchor tags not working? Hard to believe but linking to url#anchor seems not to work in FF

Posted

test1.html:

<html>
<body>
<a href="test2.html#anchor">Anchor link</a>
</body>
</html>

test2.html:
<html>
<body>
lots of text...so the window can scroll...

<a name="anchor">Here's the anchor</a>
more text
</html>
</body>

This works as expected in Chrome, but not in FF.

test1.html: <pre><nowiki><html> <body> <a href="test2.html#anchor">Anchor link</a> </body> </html> test2.html: <html> <body> lots of text...so the window can scroll... <a name="anchor">Here's the anchor</a> more text </html> </body> </nowiki></pre> This works as expected in Chrome, but not in FF.

Modified by cor-el

Additional System Details

This happened

Every time Firefox opened

Installed Plug-ins

  • Java Plug-In 2 for NPAPI Browsers
  • Shockwave Flash 11.2 r202
  • Juniper Networks Safari Extensions
  • Facebook Video Calling by Skype
  • Office Live Update v1.0
  • 5.0.61118.0
  • Garmin Communicator Plug-in Version 3.0.1.0
  • The QuickTime Plugin allows you to view a wide variety of multimedia content in web pages. For more information, visit the QuickTime Web site.
  • The Flip4Mac WMV Plugin allows you to view Windows Media content using QuickTime.

Application

  • User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:12.0) Gecko/20100101 Firefox/12.0

More Information

Application Basics
Name
Firefox
Version
12.0
User Agent
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:12.0) Gecko/20100101 Firefox/12.0
Profile Directory
Show in Finder
Enabled Plugins
about:plugins
Build Configuration
about:buildconfig
Crash Reports
about:crashes
Memory Use
about:memory
Extensions
Name
Version
Enabled
ID
ColorZilla
2.6.4.1
true
{6AC85730-7D0F-4de0-B3FA-21142DD85326}
Firebug
1.9.1
true
firebug@software.joehewitt.com
Okta Secure Web Authentication Plug-in
2.15
true
plugin@okta.com
Snagit Autoscroll Helper
1.8
true
autoscrollhelper@techsmith.com
Web Developer
1.1.9
true
{c45c406e-ab73-11d8-be73-000a95be3b12}
DownThemAll!
2.0.13
false
{DDC359D1-844A-42a7-9AA1-88A850A938A8}
Garmin Communicator
3.0.1
false
{195A3098-0BD5-4e90-AE22-BA1C540AFD1E}
PrivacyChoice TrackerBlock
2.2
false
trackerblock@privacychoice.org
Spell Checker
1.3.2
false
gaurangnshah@gmail.com
Important Modified Preferences
Name
Value
accessibility.typeaheadfind
true
accessibility.typeaheadfind.casesensitive
1
accessibility.typeaheadfind.flashBar
0
browser.cache.disk.capacity
1048576
browser.cache.disk.smart_size.first_run
false
browser.cache.disk.smart_size_cached_value
1003520
browser.history_expire_days.mirror
180
browser.places.importBookmarksHTML
false
browser.places.smartBookmarksVersion
2
browser.startup.homepage
http://www.tongshu.com/ts.jsp
browser.startup.homepage_override.buildID
20120420145725
browser.startup.homepage_override.mstone
rv:12.0
browser.tabs.loadInBackground
false
browser.tabs.onTop
false
extensions.lastAppVersion
12.0
network.cookie.prefsMigrated
true
places.database.lastMaintenance
1336671367
places.history.enabled
false
places.history.expiration.transient_current_max_pages
104019
places.history.expiration.transient_optimal_database_size
166429982
places.last_vacuum
1316043279
print.macosx.pagesetup-2
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHBsaXN0IFBVQkxJQyAiLS8vQXBwbGUvL0RURCBQTElTVCAxLjAvL0VO…
print.print_bgcolor
true
print.print_bgimages
true
print.print_command
print.print_downloadfonts
false
print.print_evenpages
true
print.print_footerleft
print.print_footerright
print.print_headerleft
print.print_headerright
print.print_in_color
true
print.print_margin_bottom
0.5
print.print_margin_left
0.5
print.print_margin_right
0.5
print.print_margin_top
0.5
print.print_oddpages
true
print.print_orientation
0
print.print_pagedelay
500
print.print_paper_data
0
print.print_paper_height
11.00
print.print_paper_size_type
1
print.print_paper_size_unit
0
print.print_paper_width
8.50
print.print_printer
print.print_reversed
false
print.print_scaling
1.00
print.print_shrink_to_fit
true
print.print_to_file
false
print.print_unwriteable_margin_bottom
56
print.print_unwriteable_margin_left
25
print.print_unwriteable_margin_right
25
print.print_unwriteable_margin_top
25
privacy.clearOnShutdown.extensions-dta
true
privacy.clearOnShutdown.offlineApps
true
privacy.clearOnShutdown.siteSettings
true
privacy.donottrackheader.enabled
true
privacy.sanitize.migrateFx3Prefs
true
privacy.sanitize.sanitizeOnShutdown
true
security.warn_viewing_mixed
false
security.warn_viewing_mixed.show_once
false
Graphics
Vendor ID
0x8086
Device ID
0x 46
WebGL Renderer
NVIDIA Corporation -- NVIDIA GeForce GT 330M OpenGL Engine -- 2.1 NVIDIA-1.6.40
GPU Accelerated Windows
2/2 OpenGL
AzureBackend
quartz

scoobidiver 12 solutions 285 answers

I filled in test2 with a Wikipedia article and the anchor link works as expected in Firefox 12.

It may be caused by an interfering extension. See Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems.

I filled in test2 with a Wikipedia article and the anchor link works as expected in Firefox 12. It may be caused by an interfering extension. See [[Troubleshooting extensions and themes]].
cor-el
  • Top 10 Contributor
  • Moderator
16650 solutions 150480 answers

Works fine here to.
There may be problems with frames though.


data:text/html;base64,PGh0bWw+Cjxib2R5Pgo8YSBocmVmPSJodHRwOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL01IVE1MI0ZpcmVmb3giPkFuY2hvciBsaW5rPC9hPgo8L2JvZHk+CjwvaHRtbD4=
Works fine here to.<br /> There may be problems with frames though. ---- <pre><nowiki>data:text/html;base64,PGh0bWw+Cjxib2R5Pgo8YSBocmVmPSJodHRwOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL01IVE1MI0ZpcmVmb3giPkFuY2hvciBsaW5rPC9hPgo8L2JvZHk+CjwvaHRtbD4=</nowiki></pre>
jscher2000
  • Top 10 Contributor
7867 solutions 64113 answers

I don't think you gave us a link, so here's a wild guess: If a script in the page changes the length of the page after loading then Firefox may scroll the wrong distance.

See this thread for an example where the script hid some elements: anchors on bottom half of page don't work -at- mozillaZine Forums.

There could be a similar problem if the script inserts new elements and lengthens the page content.


To test whether scripts are the culprit, turn off JavaScript and try the link again.

Edit > Preferences > Content

uncheck the box next to Enable JavaScript

I don't think you gave us a link, so here's a wild guess: If a script in the page changes the length of the page after loading then Firefox may scroll the wrong distance. See this thread for an example where the script hid some elements: [http://forums.mozillazine.org/viewtopic.php?f=25&t=2435111 anchors on bottom half of page don't work -at- mozillaZine Forums]. There could be a similar problem if the script inserts new elements and lengthens the page content. ---- To test whether scripts are the culprit, turn off JavaScript and try the link again. Edit > Preferences > Content ''uncheck'' the box next to Enable JavaScript

Modified by jscher2000

dejannina 0 solutions 1 answers

I had the same problem, with some script in the page that changes the length of the page after loading. I fix the problem with next code:

$(document).ready(function () { var anchor_id = window.location.hash; if (anchor_id != "") {

             var new_position = $(anchor_id).offset(); 
             window.scrollTo(new_position.left,new_position.top); 

} });

I had the same problem, with some script in the page that changes the length of the page after loading. I fix the problem with next code: $(document).ready(function () { var anchor_id = window.location.hash; if (anchor_id != "") { var new_position = $(anchor_id).offset(); window.scrollTo(new_position.left,new_position.top); } });