Редирект после прочтения страницы до конца

Опубликовано 30 Август, 2022 | Сниппеты с кодом | 940 просмотров

Добавьте html блок с кодом и поменяйте url в переменной redirectUrl на свой:

<script>
  var redirectUrl = 'https://linkrr.ru'
  
  window.onscroll = function(e) {
    var offset = window.pageYOffset || document.documentElement.scrollTop,
        windowHeight = document.documentElement.scrollHeight - document.documentElement.clientHeight,
        progress = Math.floor((offset / windowHeight) * 100); 
    if (progress === 97 ){ 
      window.location.href = redirectUrl 
    }
}
  </script>
Последняя правка от 30 Август, 2022