-5

I have the CPM adverts on my web page - when user click anywhere on the page, the script is opening a poup with advert. Is it possible to create a special script which will be click anywhere on the page without the user's knowledge?

Thanks.

NewbieUser
  • 191
  • 2
  • 10

2 Answers2

1

I think you want this...

  setTimeout(function(){
 document.getElementById('test').click();
}, 1000);
  
<div id='test' onclick='alert("ok");'>Check</div>
Anand Singh
  • 2,343
  • 1
  • 22
  • 34
  • Yee! That's it! Can you tell me how to add an limit on this script - the script should click only once (now is clicking all the time). – NewbieUser Dec 25 '15 at 12:22
  • @OP If your advertising platform allows to generate clicks _this_ easily then they deserve to be abused, but I would still stay away from doing it as it could get you in trouble if they find out. @AnandSingh Why not `setTimeout` instead? – SeinopSys Dec 25 '15 at 12:25
0

I am not sure that I understand your question.

You can read how to handle click everywhere in the page here If you want to open the popup automatically, on document ready, you can click custom html element.

EDIT

You can generate fake click this way:

(function() {
  document.getElementById('yay').click();
})();
Community
  • 1
  • 1
Mihail Petkov
  • 1,535
  • 11
  • 11
  • In following URL is an example: http://jsfiddle.net/M4teA/2/ It's working when you CLICKED on the background. I want create an script which will be click without the user's knowledge, so I do nothing and script "think" - I clicked on the webpage background. – NewbieUser Dec 25 '15 at 12:15