Lock page with timer

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
timerlock
Forum Newbie
Posts: 1
Joined: Thu Mar 15, 2012 11:49 am

Lock page with timer

Post by timerlock »

What is the easiest way to lock a page with a 30 second timer so that the visitor cannot click "Continue" until the 2 minute timer has counted down, similar to the way some forums have those 30 second times there make the visitor wait 30 seconds before click the "I agree" button to continue to the forum?

Is there a plugin or something? A script maybe? Or is the code small and easy to throw on a basic html page? It's just for a basic intro page to my site so that the visitor cannot click "Enter" until 30 seconds, which is enough time for them to read the rules/announcement on the intro page.

Anyone know? I searched everywhere on google and cannot find a script or plugin that does it.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Lock page with timer

Post by califdon »

Nothing you can do in PHP, but you could write Javascript code to only activate the link after a delay. I'll move this topic to our Javascript forum.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Lock page with timer

Post by requinix »

FWIW, if I ever found a forum like that then I would just walk away from it. Wouldn't give it a second thought. And if it was bothersome enough I'd block its results from Google (like I do Expert Sex Change) so I wouldn't have to think about it a first time ever again.

But it's not my forum. You can use setTimeout() to wait the amount of time, but after that it depends what the disabled link looks like. Disabled button? No link at all? Looks like a link but doesn't work?
User avatar
Weiry
Forum Contributor
Posts: 323
Joined: Wed Sep 09, 2009 5:55 am
Location: Australia

Re: Lock page with timer

Post by Weiry »

JavaScript is inherently problematic as anyone can simply run a browser with JS disabled, which means you need to start implementing <noscript> tags etc.
Not to mention that anyone who knows how to do JavaScript injection could change your timer anyways.

But as requinix said:
requinix wrote:if I ever found a forum like that then I would just walk away from it. Wouldn't give it a second thought.
Post Reply