Login Member
close
Subscribe
Diskon 25%, kode kupon "PANCASILA" (25 Mei - 25 Juni 2025)
Home Addson
Anti Back Button with Redirect Link

Anti Back Button with Redirect Link

"Javascript code anti back button with customizable redirect link. To trap users on current page and redirect if they attempt to leave."

anti back button with popup link

Details

This code is designed to manipulate the browser's history and navigation behavior to trap users on the current page and redirect them to a specific URL if they attempt to leave. While it can serve specific purposes, it should be used cautiously to avoid negatively impacting user experience.

Potential Use Cases

  • Anti-abandonment : Websites might use this technique to prevent users from leaving a page prematurely, such as during a checkout process or while viewing important content.
  • Redirect control : The code ensures that users are redirected to a specific page (https://www.yztheme.my.id/p/recent-comments.html) if they attempt to navigate away.


Demo

Try to navigating back or forward on this page.


Code

JavaScript

history.pushState(null, document.title, window.location.href);
window.addEventListener("popstate", function (event) {
  window.open("https://www.yztheme.my.id/p/recent-comments.html", "_blank");
});
window.addEventListener("scroll", function () {
  history.pushState(null, document.title, window.location.href);
});


Help Me Install
Komentar

Testimonials

"ringan dan lebih fresh"

Windu Cahyono rccblog.com
★★★★★

"terbaik, makasih bang, sukses selalu. Amin YRA"

elaangbdgg fraksikata.my.id
★★★★★

Kirim testimoni

Form Checkout
Punya Kode Kupon ?
By purchasing, you agree to all terms.
Konfirmasi Pembayaran
*Harus diisi
Admin CS Support
Halo, Ada yang bisa kami bantu? ...
Kirim