After clicking the return button, the window pops up to close
P粉509383150
P粉509383150 2023-08-29 15:50:07
0
1
475
<p>I'm trying to implement a feature where if a popup opens and the user cancels it and then presses the return key, it should not open the popup again but should go back to the previous page! </p> <p></p> <pre class="brush:php;toolbar:false;"><script> window.onload = function() { setTimeout(function() { window.open( "#popup_flight_travlDil3" ,"_self") }, 1000); } </script></pre></p>
P粉509383150
P粉509383150

reply all(1)
P粉458725040

You can use sessionStorage

window.addEventListener("DOMContentLoaded", function() { // or $(function() { ... in jQuery
  const popped = sessionStorage.getItem("popped");
  if (popped) return; 
  setTimeout(function() {
    window.open("#popup_flight_travlDil3", "_self")
    sessionStorage.setItem("popped",true)
  }, 1000);
})
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template