I used auto click code on my site with simple code and it worked. Below is the code which I used previously.
<script type="text/javascript">
$(document).ready(function(){
var list = document.getElementsByClassName("link");
for (var i=0; i<list.length; i++) list[i].click();
});
</script>
<div>
<a href="#" target="_top" class="link">CLick</a>
</div>
But this time my code is little plicated. I was thinking: is it possible to auto-click the ad, which is created after running of the ad script code? Below is the somewhat same html part of the ad or please check the actual html on .html
<div>
<div id="ac_152518">
<div class="ac_header_title">What Others Are Reading</div>
<div class="ac_adbox"><div class="ac_adbox_inner">
<div class="ac_container">
<a class="ac_image_link" rel="nofollow" target="_blank" href='xyz">
<img height="250" width="300" src="abc.jpg" class="ac_image">
</a>
</div></div></div></div></div>
I just want to auto-click the "ac_image_link" href element on the page load. P.S: I am not doing this for earning $$ just to satisfy myself that it is possible or not.
I used auto click code on my site with simple code and it worked. Below is the code which I used previously.
<script type="text/javascript">
$(document).ready(function(){
var list = document.getElementsByClassName("link");
for (var i=0; i<list.length; i++) list[i].click();
});
</script>
<div>
<a href="#" target="_top" class="link">CLick</a>
</div>
But this time my code is little plicated. I was thinking: is it possible to auto-click the ad, which is created after running of the ad script code? Below is the somewhat same html part of the ad or please check the actual html on http://www.meansim./adtest.html
<div>
<div id="ac_152518">
<div class="ac_header_title">What Others Are Reading</div>
<div class="ac_adbox"><div class="ac_adbox_inner">
<div class="ac_container">
<a class="ac_image_link" rel="nofollow" target="_blank" href='xyz.">
<img height="250" width="300" src="abc.jpg" class="ac_image">
</a>
</div></div></div></div></div>
I just want to auto-click the "ac_image_link" href element on the page load. P.S: I am not doing this for earning $$ just to satisfy myself that it is possible or not.
Share Improve this question asked Apr 23, 2016 at 17:21 Sagar HiranandaniSagar Hiranandani 111 gold badge1 silver badge3 bronze badges1 Answer
Reset to default 2are you still using jQuery? If yes, same as in your first example, when the document is ready:
$('.ac_image_link').click();
or
$('.ac_image_link').trigger("click");
UPDATE 2:
Be ensure that your AdBlocker is disabled, because your element gets immediately eliminated if enabled. For your situation, use this approach:
$(document).ready(function(){
var link = $('.ac_image_link').attr('href');
window.location.href = link;
});
or if it is a static link:
$(document).ready(function(){
window.location.href = "http://www.google./";
});
Hope it works now :)