Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 222
Sriraman Avatar asked Oct 20 '22 17:10

Sriraman


1 Answers

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.

like image 176
ggzone Avatar answered Oct 27 '22 17:10

ggzone