How to get href from iframe/script and redirect to it

463 views Asked by At

I have adserver running on my server, i've created HTML clickable banner and it needs href target link to redirect somewhere.

The problem is that iframe link is dynamic and may change any time. What I want is to get href from iframe and redirect to it.

<a href="LINK OF BELOW IFRAME" target="_blank"> <img src="http://example.com/banners/front.jpg" style="width:728px; height:90px ; position: absolute; z-index:2;opacity: 0.0"></a>

below code is given from company and displays banner itself

<script type="text/javascript">document.write("<iframe name='banner' src='https://target.com/scripts/banner.php?a_aid=586b827a9f74f&a_bid=a6c90d0d&w=1&refx2s6d="+encodeURIComponent(encodeURIComponent(document.URL))+"' framespacing='0' frameborder='no' scrolling='no' width='728' height='90' allowtransparency='true'><a href='https://target.com/scripts/click.php?a_aid=586b827a9f74f&amp;a_bid=a6c90d0d' target='_top'>728x90 (GIF)</a></iframe>");
</script>
<noscript>
<h2><a href="https://target.com/index.php?visitorId={$visitorid}&accountId=81c19f03&utm_source=loangate&utm_medium=affiliate&utm_campaign=loangate">728x90 (GIF)</a></h2>
</noscript>

Provided code is one html code, not separate ones.

Also note that this is not clear iframe. It is script that contains iframe itself.

So I have made clickable html and can make redirection on click. But how to get href from iframe that gave me company?

0

There are 0 answers