Sriraman
Sriraman

Reputation: 7937

Is it possible to detect the user click event in the popup window?

I can detect the user click event in the popup window if the current url and popup url is in same domain using the following code:

var myWindow = window.open("abc.html","MsgWindow", "width=500","height=600");
$(myWindow).on('click', 'a', function() {alert('a')});

But, Is it possible to detect the user activity from the external url as below?

var myWindow = window.open("http://google.com","MsgWindow", "width=500","height=600");
$(myWindow).on('click', 'a', function() {alert('a')});

The second snippet is not working for me. How can I make it work?

Upvotes: 5

Views: 905

Answers (1)

ggzone
ggzone

Reputation: 3711

No you can't becouse of SOP (Same Origin Policy) http://en.wikipedia.org/wiki/Same-origin_policy

To give you an example: You make a popup to a webpage with a login. With your method you are able to track the key input of the login information. username and password. Thats would be a major secutiry issue.

Upvotes: 3

Related Questions