Solved

anchor link w/ query string not working in ie

Posted on 2004-08-25
14
677 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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
 
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

623 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