link not working by clicking, only work by “Open link in new tab” command

后端 未结 8 1736
没有蜡笔的小新
没有蜡笔的小新 2020-12-20 11:21

I meet this interesting situation:

相关标签:
8条回答
  • I came across this issue in ReactJS after using JS to set the href property of a link. I solved it using a useState hook for what the link should be.

    0 讨论(0)
  • 2020-12-20 12:23

    Correctly given by Darren, it is definitely some javascript code that is sending an AJAX request (post or get) that is preventing the link from functioning as you would expect.

    However, if you've used an external resource, it might be difficult to correct the error in the min files.

    I suggest use a jquery onclick event inline to circumvent the AJAX call

    <a href="http://foo.bar/" onclick="window.open('https://www.foo.bar/culrsteam')">Foo</a>

    You could additionally use window.open('https://www.foo.bar/culrsteam', '_blank') like with target='_blank'

    0 讨论(0)
提交回复
热议问题