0

I add this "?loyal" in url when click button of Check Yangold, to appear my third party modal. but i would like to remove when page is reload.

This is what i'm using to add "?loyal" to url when click "check yangold" Button. here is my site link.

<script>
function myFunction() {
  window.location.replace(window.location.href+"/?loyal");
}
</script>

is it correct script for this condition?

var clean_uri = location.protocol + "/?loyal" + location.host + location.pathname;
window.history.replaceState({}, document.title, clean_uri);
Clara
  • 1
  • 1
    _“is it correct script for this condition?”_ - don‘t ask us right away - log the value of `clean_uri` that you are assembling there to the console, and then see if it makes sense. – 04FS Feb 06 '20 at 11:53
  • let's try window.history.replaceState({}, document.title, window.location.origin+window.location.pathname); – Libin Prasanth Feb 06 '20 at 11:55
  • Use this https://stackoverflow.com/a/51169659/6160662 – Vinay Feb 06 '20 at 16:18

0 Answers0