Home > database >  How to prevent anchor with query string from reloading page
How to prevent anchor with query string from reloading page

Time:12-08

How do I prevent anchor to reload page when there are query strings included in URL. Below is link which reloads page before redirecting to section directly.

<a href="https://iamhoste.com/experiences/?in-home-chef-experiences/#explore">Explore Experiences</a>

Clicking on this link reloads page and then redirect to section (#explore). Is there anyway I can prevent reloading.

CodePudding user response:

<section id="explore">
  ...
</section>
.
.
.
<div>
  <a href="#explore">The section you want to explore</a>
</div>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe> This may help you to jump to your desired section without any headache of reloading

CodePudding user response:

Add a 'target' attribute to the anchor tag and write "_blank" in it, for example : target = "_blank"

in your case : <a href="https://iamhoste.com/experiences/?in-home-chef-experiences/#explore" target="_blank">Explore Experiences</a>

as per my knowledge this should work

  • Related