0

I have a website called A i want to display another website called myFrame through A using iframe i want to count all the clicks in myFrame and want to display in my website A.myFrame site is in different domain.I did the following code but its not working. i can add any javascript code in myFrame website

<html>
<body>
Count: <span id="clicks">0</span>
<iframe id="myframe" src="http://www.myFrame.com" class="restricted" height="400px;" width="400px;" scrolling="no" frameborder="0">     
</iframe>
</body>
</html>

<script language="javascript">
$(function() {
    var clicks = 0;
    $('#myframe').contents().find('a').bind('click', function(e) {
        e.preventDefault();
        clicks++;
        $('#clicks').html(clicks);
    });
});
</script>
user1187
  • 2,116
  • 8
  • 41
  • 74

1 Answers1

2

It is impossible. Same origin policy prevents you from monitoring/accessing anything in another domain.

epascarello
  • 204,599
  • 20
  • 195
  • 236