Returning a customer to a default URL after viewing the receipt page

Updated on 20-October-2016 at 10:16 AM

Business Catalyst End of life announcement - find out more details.

After a customer has made a purchase, if they continue browsing the site, the pages will be using the site's secure URL. If you want to redirect customers to a default URL, place the following script in your Receipt (Buy) online shop layout:
<script type"text/javascript">  
var siteUrl = 'http://www.yoursite.com';  
var links = document.getElementsByTagName('A');  
  
for (i = 0; i < links.length; i++)  
{  
          if (links[i].getAttribute('href'))  
          {  
                    var href = links[i].getAttribute('href');  
                    if (href.substring(0,4) != 'http' && href.substring(0,1) == '/')  
                    {  
                              //this example requires your links to have absolute paths.  
                              //document-relative paths and absolute URLs are not supported.  
                              links[i].setAttribute('href', siteUrl + href);  
                    }   
          }  
}  
  
</script>