473,800 Members | 2,893 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why does named anchor fail on first reference?

I have a long page with several sections and want to link to these sections from
another page like this:

<a href='http://www.mysite.com/content.html#se ction12'>Sectio n 12</a>

Here's what the anchor looks like in content.html:

<h2 id="section12"> <a href=http://www.mysite.com/index.html
target="_self"> Return to Table of Contents</a></h2>

If I clear my browser's cache and click on the Section 12 link in index.html, I
do not go to the correct position in content.html. But If I go back to
index.html and try again, the link will (on subsequent attempts) take me to the
correct position.

This behavior is consistent in FF and IE.

I've also tried using a stand-alone anchor like this:

<a name="section12 ">

Same results.

Am I missing something? Is there some trick to getting a named anchor to work
the first time?

Thanks in advance.
Jul 6 '06 #1
12 2138
Els
deko wrote:
I have a long page with several sections and want to link to these sections from
another page like this:

<a href='http://www.mysite.com/content.html#se ction12'>Sectio n 12</a>

Here's what the anchor looks like in content.html:

<h2 id="section12"> <a href=http://www.mysite.com/index.html
target="_self"> Return to Table of Contents</a></h2>

If I clear my browser's cache and click on the Section 12 link in index.html, I
do not go to the correct position in content.html. But If I go back to
index.html and try again, the link will (on subsequent attempts) take me to the
correct position.

This behavior is consistent in FF and IE.

I've also tried using a stand-alone anchor like this:

<a name="section12 ">

Same results.

Am I missing something? Is there some trick to getting a named anchor to work
the first time?
I think the page is too long, or has too many images and stuff to be
loaded? I've seen it happen too, and I'm just guessing that the
browser finds the ID before all the content that preceeds it is loaded
into the browser.

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Jul 6 '06 #2
"deko" <de**@nospam.co mwrote:
>Am I missing something?
We are (an URL).

--
Spartanicus
Jul 6 '06 #3
browser finds the ID before all the content that preceeds it is loaded
into the browser.
That's something I considered - the page is dynamically generated with php and
does have some larger images.

While troubleshooting , I took the page source and made a static page out of it -
still had the same problem. Yet this is the only thing that makes any sense,
since, at that point, everything was generic HTML with simple anchors.

I think you may be correct. If so, this is browser bug. And both IE and FF
have it. A browser should be able to recognize an anchor in a URL, render the
page, then position itself accordingly.

Jul 6 '06 #4
>browser finds the ID before all the content that preceeds it is loaded
>into the browser.

That's something I considered - the page is dynamically generated with php and
does have some larger images.

While troubleshooting , I took the page source and made a static page out of
it - still had the same problem. Yet this is the only thing that makes any
sense, since, at that point, everything was generic HTML with simple anchors.

I think you may be correct. If so, this is browser bug. And both IE and FF
have it. A browser should be able to recognize an anchor in a URL, render the
page, then position itself accordingly.
I just loaded IE7 and tested with that - I could not duplicate the problem.
This is indeed a browser bug and the IE7 team squashed it. Let's hope the
Firefox folks catch on as well.

As an aside, IE is pretty speedy as far as page loading goes. I think I like
it. Too bad it breaks my ability to access my hotmail email account from
Outlook Express. Otherwise I might make it my default browser.

Jul 6 '06 #5
deko wrote:
I have a long page with several sections and want to link to these
sections from another page like this:

<a href='http://www.mysite.com/content.html#se ction12'>Sectio n 12</a>

Here's what the anchor looks like in content.html:

<h2 id="section12"> <a href=http://www.mysite.com/index.html
target="_self"> Return to Table of Contents</a></h2>
Aside: are you sure that "Return to Table of Contents" is a second
level heading? Sounds more like a navigational aid that perhaps should
be a <divor at worst a <p>.

BTW, I looked at http://mysite.com/ but couldn't find your links. If you
are using that for an example, please use .. well .. example.com, which
is reserved for the purpose.

--
-bts
-Warning: I brake for lawn deer
Jul 6 '06 #6
Deciding to do something for the good of humanity, Els
<el*********@ti scali.nldeclare d in
comp.infosystem s.www.authoring.html:
browser finds the ID before all the content that preceeds it is loaded
into the browser.
I find that happens quite often with w3c.org - the HTML and CSS specs
for example.

--
Mark Parnell
My Usenet is improved; yours could be too:
http://blinkynet.net/comp/uip5.html
Jul 6 '06 #7
Els
Mark Parnell wrote:
Deciding to do something for the good of humanity, Els
<el*********@ti scali.nldeclare d in
comp.infosystem s.www.authoring.html:
>browser finds the ID before all the content that preceeds it is loaded
into the browser.

I find that happens quite often with w3c.org - the HTML and CSS specs
for example.
That's exactly where I've seen it before :-)

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Jul 6 '06 #8
>>browser finds the ID before all the content that preceeds it is loaded
>>into the browser.

I find that happens quite often with w3c.org - the HTML and CSS specs
for example.

That's exactly where I've seen it before :-)
I discovered that if I remove all style directives and images the problem goes
away. Perhaps there's a CSS trick or work-around that will help...

Jul 7 '06 #9
Els
deko wrote:
>>>browser finds the ID before all the content that preceeds it is loaded
into the browser.

I find that happens quite often with w3c.org - the HTML and CSS specs
for example.

That's exactly where I've seen it before :-)

I discovered that if I remove all style directives and images the problem goes
away. Perhaps there's a CSS trick or work-around that will help...
Does the problem go away if you only take out the images and leave the
styles in?

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Jul 7 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3464
by: deko | last post by:
I use named anchors to take users to specific parts of a long page. But I want to add some processing and do some things with my nav bar when users go to certain sections delineated by named anchors. I understand that the anchors array creates an element for each anchor in the page when the page is loaded, but how do I identify which anchor is currently being viewed? Here's some pseudo code: if (document.anchors.name == "section_B") {
8
2560
by: lawrence | last post by:
I'm learning Javascript. I downloaded a script for study. Please tell me how the variable "loop" can have scope in the first function when it is altered in the second function? It is not defined in global space, therefore it is not a global variable, yes? Even if it was global, how would it get from one function to another? In PHP variables are copied by value. Are they copied by reference in Javascript? <SCRIPT LANGUAGE="JavaScript">
2
2766
by: SammyBar | last post by:
Hi, I'm trying to bind a custom collection class to a data grid, following the guidelines from the article http://msdn.microsoft.com/msdnmag/issues/05/08/CollectionsandDataBinding/default.aspx. The problem is the article is in VisualBasic. I already get the collection to be recognized as a Data Source by the IDE. It populated the DataGrid correctly from the fields on the items object of the collection, but I can't get the DataGrid to...
6
2589
by: clintonG | last post by:
Example: <a href="mailto:somebody@somewhere.com>Send Mail</a> I've been trying to find documentation via W3 and the RFCs but I have yet to find documentation that explains how a click event on an anchor tag can launch a client-side e-mail program and populate its To: field with an e-mail address. I've found RFCs that briefly describe mailto but they fail to describe the actual mechanism that enables the functionality.
3
3877
by: gary | last post by:
Hi, I am trying to reference an anchor in a user control with a url. This worked in 1.1 but no longer works in 2.0. The ascx control is located in a "/include" folder If you have a hyperlink control and you assign the navigateurl property = "../#anchor" whereby you want to add this # reference to the current url the url ends up with the #anchor twice.
6
2903
by: Nalaka | last post by:
Hi, Is there a gui control in VS2005 to set a "named anchor"? For an example now I go to the html and write the following code <a name="jumpToThisLocation"/>
3
4084
by: axlq | last post by:
I wrote the function below to get the vertical scroll position of an anchor. That is, a URL of the form http://www.example.com/mypage.html#anchorname should scroll to the point on the page that has an anchor <a name="anchorname">...</a>). Doing this in Javascript is necessary in the presence of a dynamic HTML page having some hidden blocks. DHTML messes up the scroll position in Opera and Mozilla (but not IE) so I'm trying to fix it...
6
2158
by: jim039845 | last post by:
The link looks like this: http://www.postpositive.net/library.php#cat6 The target looks like this: <a name="cat6">cat6</a> The link resides on this page:
8
5140
by: azjudd | last post by:
Thank you in advance for your help on this one. I'm using named anchor tags on a FAQ page with questions listed at the top and answers below; a standard jump-to feature. However, anytime an anchor tag link is used, whether it be a question down to an answer or an answer back to the list of questions, I lose the banner div, a good portion of of my MenuDv disappears, and white space is added to the bottom of my page. You can see my FAQ page...
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10273
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7574
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5603
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.