views:

96

answers:

2

Hi all.

Having an odd problem at the site. Link tag having href="#anything" doesn't move you to the top of the page or to the specified anchor, it moves you to the home page. Thats it - when I hover over the link I see at my FF's status bar "domain.com/#" instead of "domain.com/testpage.php#"

Site is full of crap code and it's impossible to verify all of the settings and especially header configuration or etc.

Any hints on where this might be?

P.S. Link's href is not altered with JS, firebug claims it to be href="#" when I click it.

+4  A: 

My initial thought is that you may have a base tag in play somewhere. Check your code for something like the following, and remove it if necessary:

<base href="http://www.mydomain.com/testpage.php" />

Obviously, caution is necessary as there may be some markup that is dependent upon any pre-existing base tags. Also make sure that your href value is not preceded with a foward slash like this:

<a href="/#anything">Click Me</a>

As this will go to #anything on the default startpage of the root directory.

Jonathan Sampson
yep found the base tag and just confirmed it to be the root of the evil. Thanks!
Brock
@Brock Was that intended to a pun? :) Hehe.
Jonathan Sampson
+2  A: 

Do you perhaps have an <base> tag in the <head> section of your code?

That will make all relative url requests start with the specified href in the base tag. If the page relies on it's presence, I'd strongly discourage you from remove it or you might be in for a lot of updating.

More info:

Tatu Ulmanen
Thanks, base tag it is.
Brock