WestCoast_BC
asked on
anchor doesn't preserve my URL
The url to my page looks something like:
http://localhost/portal/demo/index.cfm?label=Pittsburg&page_id=30
I have an anchor on my page that looks something like:
<a href="#gohere">
When I click on the anchor I would like it to go to:
http://localhost/portal/demo/index.cfm?label=Pittsburg&page_id=30#gohere
But instead it tries to go to:
http://localhost/portal/demo/#gohere
which causes an error.
How do I create an anchor that preserves the URL parameters?
Thanks for the help
http://localhost/portal/demo/index.cfm?label=Pittsburg&page_id=30
I have an anchor on my page that looks something like:
<a href="#gohere">
When I click on the anchor I would like it to go to:
http://localhost/portal/demo/index.cfm?label=Pittsburg&page_id=30#gohere
But instead it tries to go to:
http://localhost/portal/demo/#gohere
which causes an error.
How do I create an anchor that preserves the URL parameters?
Thanks for the help
ASKER
Here is a sample link that is not working:
http://www.adreflex.com/sandbox/adreflex/index.cfm?page_id=26&menu_id=67&Label=test%20page
I have not created a .htaccess and I am not aware of any URLs being rewritten. Could this something that my ISP might be doing and might be able to solve?
Thanks again for the help.
http://www.adreflex.com/sandbox/adreflex/index.cfm?page_id=26&menu_id=67&Label=test%20page
I have not created a .htaccess and I am not aware of any URLs being rewritten. Could this something that my ISP might be doing and might be able to solve?
Thanks again for the help.
That link leads to your test page. What is it not doing?
ASKER
Try clicking on the link on the page. When you click on the link I want the URL to be:
http://www.adreflex.com/sandbox/adreflex/index.cfm?page_id=26&menu_id=67&Label=test%20page#Anna
but instead I get:
http://www.adreflex.com/sandbox/adreflex/#anna
http://www.adreflex.com/sandbox/adreflex/index.cfm?page_id=26&menu_id=67&Label=test%20page#Anna
but instead I get:
http://www.adreflex.com/sandbox/adreflex/#anna
Are you resolving your URL also so as to make them User friendly as i see in your tst link!
if you link is inside the cfoutput, then you should provide a ## around it as i se there is no such cause, neither you are getting any Error!
Exact Syntax for a Tag type of Anchor is:
<a href="#C4">
and then below it should be:
<a name="C4">Chapter 4</a>
as you do need to specify the full path
are u using fusebox i thing 'Yes'
if you link is inside the cfoutput, then you should provide a ## around it as i se there is no such cause, neither you are getting any Error!
Exact Syntax for a Tag type of Anchor is:
<a href="#C4">
and then below it should be:
<a name="C4">Chapter 4</a>
as you do need to specify the full path
are u using fusebox i thing 'Yes'
This is what is in your page. Since there is no query string there, there is nothing to preserve. It's doing exactly what it should be doing.
<p>here is my test link <a href="#anna">page</a></p>
Ok, I read the question again. The page address is everything before the question mark and the query string is everything after it. The anchors you are creating are incapable of carrying the query string without it expressly being added to the anchor. The query string part is not automatically preserved.
@ dave
There is no need to pass the query String with it! as it will render automatically!
There is no need to pass the query String with it! as it will render automatically!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Good catch @sj
I don't (yet) know about it "render automatically" but I was thinking of relative links for some reason instead of named anchors. Duh.
Try this...
<a href="index.cfm?#cgi.query _string### gohere">
<a href="index.cfm?#cgi.query
Did you get rid of your base-href tag? Nothing will work right until you do!
ASKER
Thanks for all of the input. I will try and remove the base href code tonight and let you know if that solves my problem.
Unfortunately witsCOMPUTING suggestion to do something like:
<a href="index.cfm?#cgi.query _string### gohere">
won't work for me easily. The text is created via CKEditor and I would have to change CKEditor and update its anchor code in the source.
Unfortunately witsCOMPUTING suggestion to do something like:
<a href="index.cfm?#cgi.query
won't work for me easily. The text is created via CKEditor and I would have to change CKEditor and update its anchor code in the source.
ASKER
Getting rid of the <base href="... line solved my problem. Unfortunately I now have a different problem. I set a bunch of styles dynamically and now when I get rid of the<base href line my styles don't work properly. Very puzzling. I know my style .cfm page is being included because I put some test code in it and the test code is being executed.
I will post the solution when I figure out what is going on.
I will post the solution when I figure out what is going on.
Do you have some .htaccess action going on, rewriting the URLs?