-8

I want to block user to open new tab, close tab or browser window for 30 sec when user is on my home page in jquery, javascript. Kindly suggest.

user2519007
  • 49
  • 1
  • 4

1 Answers1

5

Answer 1: You can't do that. Browsers quite correctly don't let you. You can ask the browser to show a message when the user tries to close the tab/window, details in this answer, but the browser gives the user the option to go ahead and do it anyway.

Answer 2: You shouldn't do that. You have no right to trap a user on your page — not for one second, much less 30 seconds.

Community
  • 1
  • 1
T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875