可以检测用户是否有你的网站的多个选项卡打开? [英] Possible to detect if a user has multiple tabs of your site open?

查看:147
本文介绍了可以检测用户是否有你的网站的多个选项卡打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想整个网站的注册过程。

I'm just thinking about the whole site registration process.

一个用户进入你的网站,标志了,然后你告诉他你已经给他发了一封电子邮件,他需要确认他的电子邮件地址。于是,他打<大骨节病>控制 + <大骨节病> T ,持久性有机污染物打开一个新标签,打他的的Gmail 最爱按钮,不读您漫长的欢迎电子邮件的一个词,但点击他看到的第一个环节。 Gmail的打开你的网站在另一个选项卡中...

A user goes to your site, signs up, and then you tell him you've sent him an email and he needs to verify his email address. So he hits Ctrl+T, pops open a new tab, hits his Gmail fav button, doesn't read a word of your lengthy welcome email, but clicks the first link he sees. Gmail opens your site in yet another tab...

他不需要也不想要两个选项卡为您的网站开放,他只是想查看您已经不允许他进入,直到他注册了织补页。

He doesn't need nor want two tabs for your site open, he just wants to view that darn page you've disallowed him access to until he registers.

所以,我们该怎么办?我看到了一个网站(但我忘了这是什么),是做了一个很好的工作,它实际上刷新了第一个选项卡我开无需preSS什么我。

So what do we do? I saw one site (but I forget what it was) that did a really good job, and it actually refreshed the first tab I had open without me having to press anything.

我想,这可能是很好,如果我们可以检测,如果用户已经有一个标签,你的网站打开,我们既可以自动关闭新的验证标签,或者告诉他,他可以关闭它可以回去他的其他选项卡(我们现在已经更新,并记录了他)。

I'm thinking, it might be nice if we can detect if the user already has a tab to your site open, we could either close the new verification-tab automatically, or tell him he can close it can go back to his other tab (which we've now refreshed and logged him in).

或者,也许当他得到你的恼人的请检查你的电子邮件的消息,他直接去了他的电子邮件,他的电子邮件明知该电子邮件将再次联系他回到网站更换您的网站。在这种情况下,我们不希望关闭该选项卡中,但也许可以从之前救了他的位置,并有再次重定向他?

Or, maybe when he got your annoying "please check your email" message, he went directly to his email, replacing your site with his email knowing full well that the email will link him back to the site again. In that case, we don't want to close the tab, but maybe could have saved his location from before, and redirect him there again?

不管怎样,这只是用例...的问题仍然有效。 我们可以检测,如果用户已经有一个标签,你的网站打开?

Anyway, that's just the use case... the question still stands. Can we detect if a user already has a tab to your site open?

此问题的的有关如何检测的的用户已经完成了注册过程。 Ajax轮询或彗星可以解决这个问题。我特别想知道,如果用户已经开到您的网站或不是一个标签。

This question is not about how to detect when a user has completed the sign-up process. Ajax polling or comet can solve that issue. I specifically want to know if the user already has a tab open to your site or not.

推荐答案

我相当迟到了这里(超过一年),但我不禁注意到,你错过了一个令人难以置信的轻松优雅解决方案(可能你看到用什么网站)。

I'm fairly late to the party here (over a year), but I couldn't help but notice that you'd missed an incredibly easy and elegant solution (and probably what that website you saw used).

使用JavaScript你可以改变你目前有打开过窗口的名称:

Using JavaScript you can change the name of the window you currently have open through:

window.name = "myWindow";

然后,当你发送确认邮件中根本就(假设你发送一个HTML邮件):

Then when you send out your confirmation email simply do (assuming you're sending a HTML email):

<a href="verificationlink.php" target="myWindow">Verify</a>

这将导致你的网站已经被加载到,如果它已经关闭,它会打开一个新的标签与窗口的窗口中的 VERIFICATIONLINK 开放名指定。

这篇关于可以检测用户是否有你的网站的多个选项卡打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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