6

Interconnection stops when you right-click

 3 years ago
source link: https://www.codesd.com/item/interconnection-stops-when-you-right-click.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Interconnection stops when you right-click

advertisements

I'm building a quiz of some sort with a built in timer.
It's all working great and the timer sets the score depending on how fast you answer the question.
Only problem is - when someone right click the document the timer stops, and that user can think about the question, maybe google it from a mobile device or what not.
I've tried blocking right click using JS, but since its a facebook app if someone right clicks outside of the app frame - the timer still stops.

Any ideas on how to create a timer that can run regardless right clicks?
Thanks ahead!


I wouldn't use setInterval or setTimeout for this. Instead, I'd record when they started viewing the question, and when they answered it, and take the difference.

Of course, if this information is held client-side, all bets are off. :-) Even if you send the information to the server, you'd have to have some mechanism for dealing with the inevitable hand-crafted HTTP requests from people trying to cheat.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK