Solved

anchor link w/ query string not working in ie

Posted on 2004-08-25
14
670 Views
Last Modified: 2013-12-24
i need to add an anchor link to the end of a url with a query string

research tells me it should look like this:
http://url?id=querystring#anchor

in my code it looks like this:
#cgi.scriptname#?#cgi.querystring###anchor

the code seems to be working fine, since the url reads fine in the address bar.  but it doesn't move to the anchor.  

here's what i know:
* this only seems to be a problem in ie.  works fine in mozilla and netscape
* if i type the url into the address bar, the anchor does work
* the anchor is far enough down the page to cause it to scroll down, since if i type it in, it works (see above)

any ideas why this wouldn't work???

thanks!




0
Comment
Question by:dehfne
  • 6
  • 3
  • 2
  • +2
14 Comments
 
LVL 21

Expert Comment

by:pinaldave
ID: 11897342
Hi dehfne,
cover that with <cfoutput></cfoutput> in yoru code it shoudl work then after.


Regards,
---Pinal
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 11897416
Hi dehfne,
sorry for previous mail. you must be using <cfoutput> that should not be the reason.
Can you just try to put with ### (three) pounds and see what it says. I know other expert will critize this but just for try and let us know what it says.

Regards,
---Pinal
0
 
LVL 1

Author Comment

by:dehfne
ID: 11897478
the problem isn't with the code.  as i said in my post, the url reads fine in the in the browser address bar.

to be more clear:

(1) if i open the page, the url is:

http://mysite.com/page.cfm?querystring

(2) if i click on the link with the anchor, the url is:

http://mysite.com/page.cfm?querystring#anchor

yet it does not jump to the anchor.

(3) if i open the page (where the url is http://mysite.com/page.cfm?querystring) and type in #anchor at the end (so the url is http://mysite.com/page.cfm?querystring#anchor) and then press return. it does jump to the anchor.

any clues?  perhaps i posted in the wrong forum.  wasn't sure where else to put it.

thanks.
0
 
LVL 1

Author Comment

by:dehfne
ID: 11897498
oh sorry.  i replied the the first comment while you were replying again...

if i use three ### then it believes there is an extra # and chokes.  as it should.  
0
 
LVL 21

Assisted Solution

by:pinaldave
pinaldave earned 50 total points
ID: 11897500
Hi dehfne,
very interesting. This may be due to the reason, when the link is there in your url the anchor is not loaded in the page and then after when it complites the loading the page it loads the anchor in your html page but the url is already there so it does not jump but if you put the anchor manually the page is already loaded it will jump to that.
This is what happening. I am thinking the solution now.
What you can do is that... at the end of the page you can do this ...
<cflocation var="http://mysite.com/page.cfm?querystring#anchor"> again and it shoudl work.

Regards,
---Pinal
0
 
LVL 1

Author Comment

by:dehfne
ID: 11897515
i don't want to have to refresh the page b/c i might losing some information that was posted to it.  but i'll try and see what happens.  thanks.
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 11897865
Do you have the anchor defined in the page?

<a name="anchorvalue"></a>

Otherwise this will not work.

Also how are you getting to the page a link? a cflocation?  Can you post the code?

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 17

Expert Comment

by:anandkp
ID: 11899795
yeah a look at teh code shld help us figure out what cld be wrong ...
0
 
LVL 1

Author Comment

by:dehfne
ID: 11904146
i bascially did post the code.  but here it is again.

here's the anchor
<a name="top">&nbsp;</a>

here's the link
<a href="#cgi.SCRIPT_NAME#?#cgi.querystring###top">link</a>

as i said in my above post, the anchor *does work* if i merely add #top to the end of the url in the address bar.  it *does not* work if i click on the link.
0
 
LVL 17

Assisted Solution

by:anandkp
anandkp earned 25 total points
ID: 11909888
does the source code of this look the same - as u type it in the address bar ?
If yes - then it has to work ...

else try this : <a href="<cfoutput>#cgi.SCRIPT_NAME#?#cgi.querystring#</cfoutput>#top">link</a>
0
 
LVL 1

Author Comment

by:dehfne
ID: 11915821
please don't tell me that it "has to" work when it doesn't and you haven't even tried it.  it does look exactly the same, and this is why i'm posting here.  i think perhaps its a bug in ie.

i guess i posted to the wrong list.  thanks you all for trying, and i'll let you know if i find anything else out.
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 11915865
Here's the problem.

We have tried it.  And it did work for us.  You only gave us a generic link.  If you want us to test your actual page then you need to post the URL and we will check it out.

ALso have you tried using another machine?

Is there enough content BELOW the anchor?

We cannot answer any of these questions because we do not have your actual site.

It is not a bug in IE since it works for all of us.

It may be a bug in your code, but again - without an actual link to test we cannot say for sure.

All the tests we have run with the code you gave DO work in IE and other browsers.
0
 
LVL 18

Accepted Solution

by:
Plucka earned 50 total points
ID: 11962991
Hi dehfne,

This is the right topic area, hope I can help. Here is a working example.

http://www.ns.com.au/test.cfm

Here is the code

<cfoutput>
    <cfloop index="count" from="1" to="10">
        <br>
    </cfloop>
    <a href="test.cfm?query=xyz##anchor2" name="anchor1">Go to Anchor 2</a>
    <cfloop index="count" from="1" to="10">
        <br>
    </cfloop>
    <a href="test.cfm?query=xyz##anchor1" name="anchor2">Go to Anchor 1</a>
    <cfloop index="count" from="1" to="100">
        <br>
    </cfloop>
</cfoutput>

Let me know if you have any questions

Regards
Plucka
0
 
LVL 1

Author Comment

by:dehfne
ID: 11968900
i can't seem to get this to work, so i'm giving up.  i can't post the link, since you need an account and i can't give them out.  perhaps that would have helped i don't know...

since no one really was able to help me, but many of you tried, i split the points between the most viable answers.

thanks!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now