I want to reload a page with some parameters I uses this code-
location.reload('https://makemyfoam.com/checkout#three');
but it reload the page on https://makemyfoam.com/checkout.
I use javascript code-
window.location.href = window.location.href + "#three";
it only adds the #three in URL instead of loading the page.
but I want to reload the page on https://makemyfoam.com/checkout#three .
You can try
const loc = window.location;
loc.href = loc.origin + loc.pathname + "#three";
loc.reload()
PS: please note using location.origin+location.pathname+'#anchor' instead of location.href+'#anchor' to avoid getting something like that:
https://www.example.com/page#anchor1#anchor2#anchor3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With