elementor

Can I remove parameter from URL generated by video playlist in Elementor


Elementor Pro has a new widget, video playlist. It appends a parameter to the URL, like so: http://aaronpenton.net/ampcreative/vip/about-vip/?playlist=f68425e&video=b8a9967

This is obviously terrible for SEO and UX. Is there a way to remove the ?playlist=f68425e&video=b8a9967 ?


Solution

  • My brother help me with the next script. Put a "HTML Elementor Widget" with the following:

        <script>
    function getURLParameter(name) {
      return decodeURI((RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]);
    }
    
    function hideURLParams() {
      //Parameters to hide (ie ?playlist=value, ?video=value, etc)
      var hide = ['playlist','video'];
      for(var h in hide) {
        if(getURLParameter(h)) {
          history.replaceState(null, document.getElementsByTagName("title")[0].innerHTML, window.location.pathname);
        }
      }
    }
    
    window.onload = hideURLParams;
    </script>