Sunday, July 26, 2009

When using "#" make the page refresh

I had an anchor link on a homepage that was to open a DHTML-style window. But to establish the link the <'a'> tag had href="#". This wasn't an issue except for when you first visited the homepage and clicked that link, the page would first refresh and then you'd need to click the link again to finally open the window. Once you were on the site, even if you re-visited the page, it would behave correctly. Not major, but most users were expected to click the link on the first page hit, and aside from being confusing it didn't look too professional.

At first I thought it was related to the homepage initially showing up as "www.websitename.com" and later as "www.websitename.com/index.php". But even when I changed some references to "www.websitename.com" (or to index.php) the problem persisted.

Then I tried emptying the href reference (e.g. href="") but that didn't work either. So I finally went ahead and eliminated the href completely. The remainder of my link tag looks exactly the same. Thought the feature wouldn't work, but it's running perfect. Problem solved!

No comments:

Post a Comment