开发者

Displaying a question on a site for 30 seconds

开发者 https://www.devze.com 2023-02-17 14:22 出处:网络
Putting together a trivia website where participants only get 30 seconds to see a hint and answer it. The hints can be written questions (could be in images or text whichever is harder to cheat) or pi

Putting together a trivia website where participants only get 30 seconds to see a hint and answer it. The hints can be written questions (could be in images or text whichever is harder to cheat) or pictures of places (e.g. show a picture of a statue and participant has to guess where it is).

What I'd like to do is be able to have someone indicate they are ready 开发者_Python百科by pressing a link, immediately have the hint displayed and make it disappear once 30 seconds has elapsed. If it is an image I think it will need to be preloaded...

The main concern is the participant having an unfair advantage by somehow viewing the hint before they've pressed "go". My question is can you give me a general direction or idea for doing this.

Thanks

Andrew

Wow - thanks for the awesome ideas everyone -

They must have answered the question within 30 seconds or else it won't count so taking a screenshot won't help (unless they want to give it to the competition to help them).

It seems everyone thinks that I can't serve the user the hint until they click go, but if it was an image, is there a way to hold the timer until the file is 100% served to them?


You could have a look on Node.js, it is really powerful when you want to deal with some real-time event server-side.

By the way, there is no way to prevent people making screenshots when they have the hint on the screen ;)


Assuming you can control the browser (nothing like Firebug, etc) then I would suggest that you use javascript to download the hint (so they can't browse the source) and display it. When the timer elapses, then the hint is undisplayed and erased.


Just an idea, no code:

You don't need to preload the hint. Try using AJAX. After the participant click GO, get the hint using AJAX and, after loading it, start the counter.


How secure do you need this to be? If you need something more than simply displaying it with JavaScript at the right time, then don't send the hint until the user clicks the link. When they click the link, hit your server with an AJAX request, and when the request is finished, immediately display the hint.


I think the easiest method would be to use a flash animation. It would be a simple matter to create a button which will play the movie for another 30 seconds, then hide the hint once the 30 seconds is up.

You could even program the flash animation to dynamically pull the content based on encrypted parameters. This would allow you to write 1 movie to display all hits easily (and interactively).


I think the safest way to go about this is only retrieve the hint from the server when they press go, and make sure you delete the DOM element all together when the time is up.

You cannot prevent them from taking a print screen while the hint is displayed, but you can capture keyboard and mouse input so that they could not copy the text from the page.

0

精彩评论

暂无评论...
验证码 换一张
取 消