-1

I have a simple online game where the people have to answer on questions. They have max 30 seconds to make an answer and I found that most of people using "copy and paste" to simply copy a question to Google search and find an answer in internet. Or they also can use "select text" and use RMB menu item "Search this in Google".

What I am looking for is a good protection. Mouse button disabling is not effective, and I don't want to restrict to copy other content.

My best idea is to use a font with mixed characters. I will use this font for questions only, they can copy and paste a question written by such font, but they will see a mess when putting it to Google search line.

Do you think it will work? Or you can propose better idea? If you think mixed-character font is a good idea, how can I make such font? Is there any tool for this?

Thanks!

Epsiloncool
  • 1,435
  • 16
  • 39
  • Won't your font idea wreck accessibility? – Austin Pray Oct 09 '15 at 02:46
  • @AustinPray Which accessibility you mean? – Epsiloncool Oct 09 '15 at 02:46
  • https://www.w3.org/WAI/intro/accessibility.php – Austin Pray Oct 09 '15 at 02:47
  • @AustinPray This font will look like any other font. Anyone can increase its size or select contrast scheme. I don't think it will wreck accessibility at all. – Epsiloncool Oct 09 '15 at 02:49
  • Haha dude if you copy paste and it comes out as gibberish a screen reader will read gibberish. – Austin Pray Oct 09 '15 at 03:16
  • Yes, I want to forbid copy and paste or at least make pasted text unreadable. You understood correctly. – Epsiloncool Oct 09 '15 at 03:22
  • You will never make this 100% cheater proof*, but if you see my answer you can at least detect switching tabs, and can disable the right-click and copy functions. If you mix these together you get a decent, but not unbeatable anti-cheat system. (*For example, I can pull out my smartphone and google it on that.) – nothingisnecessary Oct 09 '15 at 03:29
  • I have checked - being a fast writer, I can't retype a question to another window, make a search, collect an answer and enter it to the game answer window enough fast. I will sufficiently lose my scores, as other users who really knows an answer will beat me. And also retyping is too much work. One or two questions and you will loose interest in retyping. – Epsiloncool Oct 09 '15 at 03:42
  • What is the URL of your game? – nothingisnecessary Oct 09 '15 at 03:59
  • http://sim-portal.ru/chat.html But it's in Russian. Green text is a question. – Epsiloncool Oct 09 '15 at 04:03
  • 1
    Generate your questions as images (trivial using php/node with a graphics module), and give them an `alt` attribute with the actual question. Screen readers will read the right thing, and people can't copy/paste without taking the same effort that breaks everything else you can think of: opening dev tools – Mike 'Pomax' Kamermans Oct 09 '15 at 16:45
  • Why to add alt attribute? – Epsiloncool Oct 09 '15 at 16:55

1 Answers1

1

There is not a whole lot you can do here.

When you copy and paste into the browser's text input the special formatting (styling) will be lost and only the characters will be pasted. And fast enough typists can just manually type this.

  1. One thing that you could do - but that the community will probably shoot me for even suggesting - is to try to take advantage of the fact that when you tab out or lose focus on a browser window, most browsers (that I am familiar with: Chrome, FF, and IE) will slow down the clock for timers to something like every 1 second. So if you set a fast timer, say every 1/10 of a second, then you could check whether the user "cheated" by putting the browser window in the background (ie, switching tabs to Google the question). Unfortunately, this fails if user opens new window instead of switching tab.

Here is some code that will do that. It works in Chrome. Didn't test elsewhere.

var msDelay = 100;
var pageInBackground = false;
var epoch = new Date();
var bgMonitor = setInterval(function() {
  var newEpoch = new Date();
  var lagMs = newEpoch - epoch;
  epoch = newEpoch;
  if (lagMs > msDelay * 2) {
    pageInBackground = true;
    alert("NO CHEATING! YOU SWITCHED TABS!");
    clearInterval(bgMonitor);
  }
}, msDelay);
<h2>QUESTION: WHO IS BURIED IN GRANT'S TOMB?</h2>

<h4>NO CHEATING! YOU CANNOT SWITCH TABS AND GOOGLE IT! OR ELSE!</h4>

<h3>HINT: TRY TO OPEN A NEW TAB</h3>
  1. Another thing you can do, but that may be more easily defeated than the first attempt, is to hook into the oncopy event handler. This method also disables the context menu to avoid the right-click-to-search feature. For example:

document.getElementsByClassName('question')[0].oncontextmenu = 
  document.getElementsByClassName('question')[0].oncopy = 
    function(){alert("CHEATER!!!!"); return false;};
<h4 class='question'>QUESTION: WHO IS BURIED IN GRANT'S TOMB?</h4>

<h4>NO CHEATING! YOU CANNOT COPY THE QUESTION AND GOOGLE IT! OR ELSE!</h4>

You could combine these, and maybe accomplish what you are trying to do..

In my experience, the cheaters will always have an edge. You may want to go about tackling this problem differently - not from a technical standpoint, but from a motivation standpoint. What is the user's motivation for playing your quiz game? How do they get rewarded? Is it a race-for-time against other players? Do they get rewarded points? Can you deduct points for "cheating"?

nothingisnecessary
  • 6,099
  • 36
  • 60
  • Sorry, onclick can be simple overriden, there are already some plugins for this. For the first your proposition: I don't want users to be always on game's page. Some users prefer to have this game window to be small and shown near of big main window and answer only if they see any good question for them. – Epsiloncool Oct 09 '15 at 03:35
  • The idea with mixed-chars font is meaning you can copy text and paste somewhere, but in case I have letters "R" and "H" are exchanged, you will see "Hello world!" in the question and pasted text will be shown like "Rello wohld!". – Epsiloncool Oct 09 '15 at 03:49
  • Yeah, I get the idea of a scrambled font. It's an interesting concept. I didn't see anything out there for this yet, but if you made a font where the character `R` actually looked like an `H` that would be a cool way to deter plagiarism. You could scramble text like this: http://www.glitter-graphics.com/generators/scramble.php. Did you konw taht the hmaun biarn can fguire out srcemlbad wdros if the frist and lsat letrtes are in the crreoct pisooitns? – nothingisnecessary Oct 09 '15 at 04:06