简体   繁体   English

有没有办法检测用户在javascript弹出窗口中的点击?

[英]Is there any way to detect user clicks in the javascript popup?

I want to check whether the user liked the facebook page opened in the popup. 我想检查用户是否喜欢在弹出窗口中打开的Facebook页面。 I know that we can't detect the user activity in the javascript popup due to the Same origin Policy . 我知道由于同源策略 ,我们无法在javascript弹出窗口中检测到用户活动。 I want to find whether the user clicked the like button in the opened facebook page in the javascript popup. 我想查找用户是否在javascript弹出窗口中打开的Facebook页面中单击了赞按钮。

If it is not possible, then how the social exchange sites like http://addmefast.com , http://like4like.org etc., are working. 如果不可能,那么诸如http://addmefast.com : http://like4like.org http://addmefast.com http://like4like.org等社交网站的运作方式。

UPDATE : 更新:

If I want to do it in the same domain, I can do it with the following snippet 如果我想在同一域中进行操作,可以使用以下代码段进行操作

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

But, I want to do it another website. 但是,我想在另一个网站上做。 So, Following snippet can't work :( 因此,以下代码段不起作用:(

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

Thanks in advance, 提前致谢,

The truth is that you can't. 事实是,你做不到。 You need to own both sides, or speak with the other party to set up a policy; 您需要拥有双方,或与另一方交谈以制定政策; use the same domain; 使用相同的域; or have the user use an older/less secure browser. 或让用户使用较旧/较不安全的浏览器。

You could however get the 'likes' from someone by using Facebook's API, given the privacy options from the user of course. 但是,考虑到用户的隐私选项,您可以使用Facebook的API从某人那里获得“喜欢”。

The sites you mentioned, and other sites that collect user data (annoying IMO) do so by having the owner of the website implement part of their code (like i.po.st does on Explosm.net ). 您提到的站点以及其他收集用户数据的站点(使IMO烦恼)通过使网站所有者实现其代码的一部分来实现(如i.po.stExplosm.net所做的那样 )。 They offer a solution such as adding "Sharing" options, meanwhile they collect user data. 他们提供解决方案,例如添加“共享”选项,同时收集用户数据。
It's not very different to what Google does with Analytics . 这与GoogleGoogle Analytics(分析)所做的没有太大不同。

Another way they use is by adding advertisement, not only they profit from advertising, but they also collect user data. 他们使用的另一种方式是添加广告,不仅他们从广告中获利,而且还收集用户数据。 So let's suppose Company A pays thousands of websites to show advertisements (like Google Ads ). 因此,假设公司A支付了数千个网站来展示广告(例如Google Ads )。
This website would be able to get information from a LOT of users from a LOT of websites, by showing their ads, and adding tracking code (shameless evil creatures) . 通过显示他们的广告并添加跟踪代码(无耻的邪恶生物) ,该网站将能够从很多网站上的很多用户那里获得信息。 They either use it to show more interesting advertisement, sell it, or share it with other similar sites, and form a network of evil doers who invade your privacy for "targeted advertising". 他们要么使用它来显示更多有趣的广告,要么出售它,或者与其他类似网站共享它,并形成一个恶作剧者网络,他们通过“目标广告”侵犯您的隐私。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Javascript - 如何检测用户点击导航弹出窗口的选项 - Javascript -Way to detect on what option user clicks on Navigation Popup 当用户单击浏览器操作按钮时,是否有任何方法可以检测到Shift-click或Control-click? - Is there any way to detect a shift-click or control-click when a user clicks the browser action button? javascript中有什么方法可以检测用户在文本输入框中输入的语言? - is there any way in javascript to detect the language entered by the user in a text inpout box? 用户单击任何图像时如何创建弹出窗口? - How to create a popup when user clicks on any images? 如何检测用户是否查看页面的javascript或单击浏览器中的检查 - How to detect if the user views a page's javascript or clicks on inspect in the browser 有没有办法用javascript带来一个弹出窗口? - Is there any way to bring a popup front with javascript? 更容易知道用户何时单击任何iframe的方法? - Easier way to know when a user clicks on any iframe? 用户单击停止加载按钮时会发生任何 Javascript 事件吗? - Any Javascript event occurring when user clicks Stop load button? 检测用户是否在圈内点击 - Detect if user clicks inside a circle JavaScript / jQuery-是否可以检测点击类型? - JavaScript / jQuery - Any way to detect click type?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM