-2

I have an <a href="/other-page"> that when I click on it changes the address bar to mysite.com/other-page but does not load it...

I need to do right-click and then open the link in new tab in order to really open the desired page.

I thought that is a bug of Chrome, but I tested in IE(11) and it behaves similarly...

What could be the cause of this "strange" behavior?

PS. I don't use (at least, intentionally) and don't want to use, any browser history manipulations. I just need to classically open a simple link in the same page, it's all I need!

serge
  • 9,891
  • 17
  • 84
  • 142
  • Do you have a single page applicaton? A static page? More context please, there could be an issue with the location headers. – Olavi Sau Nov 04 '15 at 10:58
  • Possible duplicate of [Good tutorial for using HTML5 History API (Pushstate?)](http://stackoverflow.com/questions/4015613/good-tutorial-for-using-html5-history-api-pushstate) – PeeHaa Nov 04 '15 at 10:58
  • The "the **concrete** similar online **link** behavior for question" is using the history API as I just linked – PeeHaa Nov 04 '15 at 11:04
  • why do you think is using history API? I don't need to use any history manipulations – serge Nov 04 '15 at 11:05
  • "why do you think is using history API" because that is how it works... "I don't need to use any history manipulations" In that case your "**concrete** similar online **link** behavior for question" sucks – PeeHaa Nov 04 '15 at 11:09
  • The only information you have provided is a external link. Which is the only thing we can go by. And I just gave the the solution of said link. If that is not what you want there is no way for anybody to be able to help you solve your problem with the information included in the question – PeeHaa Nov 04 '15 at 11:12
  • The provided link should be fixed. But I didn't find any solution in the "duplicate" post, nor in the provided link https://developer.mozilla.org/en-US/docs/Web/API/History_API, because *I don't see any `window.history` usage* in the page I linked in the OP – serge Nov 04 '15 at 11:34
  • @PeeHaa: I found the problem: this is because of the `position:fixed` and the `z-index: 1` of the container... so nothing to do with History API – serge Nov 04 '15 at 14:22
  • This question is improperly tagged as JavaScript. Correctly tagging it as `html` will lead to more views from people with the same issue and more upvotes in the future. – Clint Apr 05 '18 at 12:10

2 Answers2

1

I found that the problem was because of the position:fixed and the z-index: 1 of the container...

The absolute or fixed positions could combined with the z-index > 0 could cause this kind of problems.

As I didn't want to change the display position of the container, my solution was to "hack" the href behavior:

<a href="/myurl" onclick="parent.location='/myurl'; return false;">
    show more...
</a>
serge
  • 9,891
  • 17
  • 84
  • 142
0

You should add the attribute in the anchor tag target="_blank".

<a target="_blank" href="http://your_url_here.html">Link</a>

Remove target="_blank then open same tap

Ivin Raj
  • 3,237
  • 2
  • 17
  • 46