0

We have some generated pages whose URLs contain parameters, like http://example.com/page.do?param1=hello. These pages contain named anchors inside, <a name="here">like this</a>. And there are corresponding links that reference the named anchors, <a href="#here">like this</a>. Most folks today call these "skip links".

Clicking a skip link should result in the browser creating and following a URL that matches the original one, with the named anchor tacked on at the end: http://example.com/page.do?param1=hello#here

On Firefox and IE, this works fine. On Chrome, Safari and other WebKit-based browsers, the parameters are lost, leading to http://example.com/page.do?#here which is invalid for our site, and just causes a 404 error.

Interestingly, if you manually put the full link in the location bar and press Enter, it behaves properly.

I've googled around a while and seen a lot of discussion about WebKit having problems with skip links, but none of them match the situation here where it's losing parameters.

Is this loss of parameters a known bug? Has anyone seen a workaround?

1 Answers1

0

I encountered the same issue. From what I can say this is related to the usage of a meta tag like this: <base href="http://example.com" />. Once it is set my links point to example.com#foo instead of example.com?foo=bar#foo.

Knowing that I found this question. So the anchor tag behavior is a known thing: Is it recommended to use the <base> html tag?

Since I can't remove the base tag I'll try to handle this with JavaScript.

Community
  • 1
  • 1
Sven Bluege
  • 1,418
  • 1
  • 10
  • 19