检测网站是否已经打开并重用窗口

编程入门 行业动态 更新时间:2024-10-26 02:32:27
本文介绍了检测网站是否已经打开并重用窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我试图找出是否有办法在电子邮件中打开 url 链接并在某个页面(或站点)已经打开时重用窗口.我有一个忘记密码"页面,用户输入他们的电子邮件地址并被问到一个安全问题,然后发送一封带有 url 链接的纯文本电子邮件(因此没有 html 链接属性)并向用户报告它有做得很好.当用户点击链接时,它会打开一个闪亮的新浏览器窗口,并忽略旧的报告页面,让它感到悲伤和不受欢迎.我想知道是否有办法重用此窗口或更具体地说是忘记密码报告页面.也许我可以用 javascript 命名页面或检测 url 是否已经以某种方式打开.或者,如果我决定使用 html 电子邮件,是否有可能让大多数人受益.

I'm trying to find out if there is a way to open a url link in an email and reuse a window if a certain page ( or site ) is already open. What I have is a 'forgot password' page where the user enters their email address and gets asked a security question, this then sends a plain text email with a url link (so no html link attributes) and reports to the user that it has done a good job . When the user clicks on the link it opens up a shiney new browser window and ignores the old report page leaving it feeling sad and unwanted. I would like to know if there is a way to reuse this window or more specifically the forgot password report page. Perhaps I could name the page with javascript or detect if the url is already open somehow. Or is it possible if I did decide to use an html email, so most people would get the benefit.

请帮助我的报告页面再次被爱和被通缉.谢谢

Please help my report page to loved and wanted again. Thanks

我正在使用 PHP,我可以使用 javascript 或 jquery 浏览器端,或其他任何可能适合于此的东西

I am using PHP and I could use javascript or jquery browserside, or anything else that might fit in with this

推荐答案

这完全由浏览器决定;某些浏览器可能会猜测您要执行的操作并将现有选项卡替换为新页面,但总的来说这没有意义.

This is completely up to the browser to decide; some browsers might be able to guess what you're trying to do and replace an existing tab with the new page, but on the whole that doesn't make sense.

这就是你可以做的(虽然这不是技术性的):

This is what you could do (though it's not really technical):

在输入并提交电子邮件后,表单页面会发生变化并要求他们提供发送给他们的安全代码.

after the email is entered and submitted, the form page changes and asks them for the security code that's being sent to them.

在电子邮件中,您以清晰的方式打印安全代码,供用户双击并复制到剪贴板;然后他们会再次切换到他们的浏览器(您的页面仍然打开)并粘贴该值.当然,为了方便用户,您仍然可以提供链接.

inside the email you print the security code in a clear manner for the user to double-click and copy to their clipboard; they would then switch to their browser again (with your page still open) and paste the value. You can still provide the link for ease of the user, of course.

顺便说一句,为了让用户可以轻松选择代码并将其复制到剪贴板中,我发现使用 base32 编码是最好的;即使使用 iOS 设备,也可以轻松选择这些代码.

Btw, to make an easily selectable code for the user to copy into their clipboard I found that using base32 encoding is the best; those codes can be selected easily, even with iOS devices.

这篇关于检测网站是否已经打开并重用窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-25 23:25:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1125427.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:窗口   网站

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!