0

I try to open the current page in a new window when the user click on the Adsense ADS

<script>
  $(document).ready(function(){
    var link= $(location).attr('href');
    $('.pub').click(function(){
      window.open(link);
    });
  });
</script>
<div class="pub">
  here the ADS Code 
</div>
Alexander Mikhalchenko
  • 4,525
  • 3
  • 32
  • 56

1 Answers1

0

You should use location.href, not $(location).attr('href')

<script>
$(document).ready(function(){
  var link = location.href;
  $('.pub').click(function(){
    window.open(link);
  });
});
</script>
Alexander Mikhalchenko
  • 4,525
  • 3
  • 32
  • 56