Advertisement
briank

Kartra Account Domain Redirect To Custom Domain

Aug 10th, 2021
2,838
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * Redirect to custom domain page via Kartra account domain page:
  3.  * Set the page redirect to the desired custom domain page and add this
  4.  * at the top of the HEAD section of the Kartra account domain page.
  5.  * Any parameters will be protectively encoded with kartraEscapeQuery.
  6.  */
  7. function kartraEscapeQuery (qs) {
  8. return '?$=' + encodeURIComponent(encodeURIComponent('&' + qs)) + '&' + qs;
  9. }
  10. var red = document.querySelector('meta[data-redirect]');
  11. if (red && location.search.length > 1) {
  12. red.remove();
  13. var info = JSON.parse(red.dataset.redirect).custom;
  14. location = info.protocol + info.url + kartraEscapeQuery(location.search.substring(1));
  15. }
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement