如何在iframe中跟踪用户 [英] How to track the user in an iframe

查看:146
本文介绍了如何在iframe中跟踪用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想跟踪用户点击IFrame中的链接时iframe内发生的情况。包含iframe(父级)的页面用于跟踪用户在iframe中的页面导航。两个页面都将托管在同一个顶级域名中,尽管子域名会有所不同。

I want to track what happens inside an iframe when a user clicks on links in the IFrame. The page that contains the iframe (the parent) is to track the user´s navigation through the page in the iframe. Both pages will be hosted on the same toplevel domain, although the subdomains will differ.

我需要通知父页面每次点击,但我没有直接控制我加载到iframe的页面。

I need the parent page to be notified of every click, but I do not have direct control over the pages I load into the iframe.

每当加载iframe中的页面时,是否可以向所有链接添加onclick?我该怎么做?

Is adding an onclick to all the links whenever the page in the iframe is loaded possible? How would I go about doing this?

这将是构建的模板:

<html>
 <script language="javascript">
     var currentURL;
 </script>
 <body>
     <iframe id="container" width="500" height="500" src="http://subdomain.parentdomain.com"/>
 </body>

推荐答案

我打算使用AJAX-Proxy让内容(就浏览器而言)来自我的域名。这将解决CodeJoust提到的所有跨域脚本问题。由于我将产生的开销,交付速度可能是一个问题,但必须看到。

I am going to use an AJAX-Proxy to have the content (as far as the browser is concerned) come from my domain. This will solve all the cross domain scripting issues that CodeJoust mentioned. Speed of delivery might be a problem due to the overhead I will be generating, but that will have to be seen.

我可能会沿着这个Stackoverflow问题行:

I will probably move along the lines of this Stackoverflow Question:

应用onclick对iFrame中的所有元素

"Apply "onclick" to all elements in an iFrame"

关于代理和更改内容的法律问题动态页面,必须进行检查。我认为,从道德角度来看,跟踪明确表示同意的用户是没有问题的。

Regarding legal issues pertaining to proxying and changing the content of pages dynamically, it will have to be checked. I believe that tracking users that give their express consent is, from an ethical standpoint, unproblematic.

这篇关于如何在iframe中跟踪用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆