0

Hello I am using the below script to display my advertisement

<a href="<?php the_permalink() ?>" onclick="func()" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a>

i am using onclick to display my advertisement

<script>
function func()
{
  window.open("xxxxx.html", '_blank');
  return false;
}

this is my function

xxxxx.html is

    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- xxxxxxxxxxxx -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-xxxxxxxxxxxxx"
     data-ad-slot="xxxxxxxxxxxxx"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

It is only opening the advertisement window but i want to open the link used in xxxxx.html (i.e) script i denoted above

Abhitalks
  • 27,721
  • 5
  • 58
  • 81
  • it's opening a blank window? – Yerko Palma Mar 20 '15 at 12:20
  • Please don’t deny that you’re the same person who asked this an hour earlier: http://stackoverflow.com/questions/29164301/i-want-to-redirect-my-advertisement-script-when-i-click-a-href-link#comment46548140_29164301 – CBroe Mar 20 '15 at 13:17
  • hello Yerko Palma its opening advertisement popup, but i want to automatically click on that advertisement.... – sivaram kundadam Mar 21 '15 at 17:57

1 Answers1

0

Hope I did get it good: don't use return false path to continue navigation.

Html:

<a id="your_anchor" href="<?php the_permalink() ?>"  title="nothing" rel="bookmark">Click Here</a>

JS:

document.getElementById("your_anchor").addEventListener("click", function ()
{
  window.open("http://www.yoursite/xxxxx.html", '_blank'); 

}

New window open, user continue navigation to ?php the_permalink() ? page, example here: http://jsfiddle.net/041ammg4/

SilentTremor
  • 4,747
  • 2
  • 21
  • 34
  • it works fine MR.Silent Tremor, but in xxxxx.html file i gave an advertisement script. When xxxxx.html is clicked the advertisement popup window was opened correctly, but i want to click the script written inside xxxxx.html (ie) advertisement popup. that is my actual question, so help me for this problem.... – sivaram kundadam Mar 21 '15 at 18:06
  • I don't understand you, you want to click on the script, meaning you want to simulate click in new open window, witch you are not controlling (add), to fake user click, that's your question? – SilentTremor Mar 22 '15 at 15:59
  • In xxxxx.html i give a script. But when i click xxxxx.html it opens the box window like google advertisement, then again i click that ad link then only which go to advertisement page. So (when i click xxxxx.html, it directly goes to the advertisement page)-->this is my actual need so help me for that.. – sivaram kundadam Mar 23 '15 at 07:53
  • Opened Add window is your code? If yes, add after load in opened window $("your link rule").click(); and check here how to close entire shebang http://stackoverflow.com/questions/19761241/window-close-and-self-close-do-not-close-the-window-in-chrome – SilentTremor Mar 23 '15 at 08:20
  • sorry your link dont useful for me... please read my question correctly – sivaram kundadam Mar 23 '15 at 10:14