I have a proble in getting parent url address in iframe from my project.
so, i have let's say ads.php located in www.domain1.com/ads.php
it's look like this
<?php
//iklan.php
if($_GET['klik'] == 'yes')
{
//klik process
exit;
}
$some_content = '
document.write('<iframe src="www.domain1.com/ads.php">
<a href="www.domain1.com/ads.php&klik=yes">klik_link</a>
</iframe>');
';
echo $some_content;
?>
and then i have test.html located in www.domain2.com/test.html that look like this
<html>
<head>
</head>
<body>
<script type="text/javascript" src="www.domain1.com/ads.php">
</script>
</body>
</html>
my question is, how can i get the value of url address frame parent which is "www.domain2.com/test.html" in my ads.php file.
i already try $_SERVER and $_SERVER but i got me "www.domain1.com/ads.php" which is the src of my iframe.
i also try with javascript "parent.location.href" but failed, because it's only work if the domain is the same.
anyone has a solution? been struggling with this in this 2 day. :(