在特定标签中打开链接 - 从电子邮件中 [英] Opening links in a specific tab - from an email
问题描述
此电子邮件只包含说明和指向我网站上激活页面的链接。
所以假设我在网站上注册,打开一个新的选项卡来检查我的电子邮件,然后点击链接,这将在另一个新的选项卡中打开,导致在该网站上打开两个选项卡(其中一个是btw仍然告诉他们检查他们的邮件)。
有没有办法让电子邮件中的链接在我的网站的第一个标签中打开? (或者如果前一个关闭或移动到另一个域,请打开一个新的标签)。
感谢任何帮助/建议!
您可以使用JavaScript分配命名您当前的窗口/标签:
< script type =text / javascript>
this.name =mainWindow;
< / script>
然后,您将该名称用作目标的值$ c $链接中的c>属性,如
< a href =nextPage.htmltarget =mainWindow> ..
如果 mainWindow
尚未(或不存在,它将在新的选项卡中打开。
更新
以上内容不能解决OP的问题,因为从电子邮件打开的链接,目标
属性通常不会从MUA转移到浏览器(除了网络邮件发送者,但我们不能依赖这一点)。所以我在想一些使用JavaScript来达到预期效果的目标网页:
- 如果目标窗口/ tab`mainWindow`有已经被打开了,将其重点放在那里,并在那里进行激活,并关闭自己。
- 如果目标窗口/标签不存在,请在我们所在的地方执行激活。
如果这样工作,在关闭本身之前,您将只会看到第二个打开的选项卡(案例1)。然而,当我学习此处和这里 - 所以最终会有一个多余的选项卡,这应该是避免。似乎不能完成,对不起!
I have a registration system on my website which uses the common activation email trick. This email simply contains instructions and a link to the activation page on my website. So suppose I registered on the site, opened a new tab to check my emails and then clicked on the link, which will open in another new tab, resulting in two tabs open on the site (of which one is btw still telling them to o check their mail).
Is there a way to get the link in the email to open in the first tab on my website? (Or open a new tab if the previous one was closed or moved to another domain).
Thanks for any help/suggestions!
You can name your current window/tab with a JavaScript assignment:
<script type="text/javascript">
this.name = "mainWindow";
</script>
Then you use that name as value for the target
attribute in links, like
<a href="nextPage.html" target="mainWindow">...
If mainWindow
does not yet (or no more) exist, it will open in a new tab.
Update
The above stuff does not solve the OP's problem, because for links opened from emails, the target
attribute will usually not be transferred from MUA to browser (except maybe for webmailers, but we cannot rely on this). So I was thinking of some kind of landing page which uses JavaScript to achieve the desired effect:
- If target window/tab `mainWindow` has already been opened, focus it, perform activation there, and close ourselves.
- If target window/tab does not exist, perform activation right where we are.
If this worked, you would only see a second open tab for a moment (case 1), before it closes itself. Yet it is not possible to "close ourselves", as I learned here and here - so in the end there would be a superfluous tab left, which should have been avoided. Seems like it cannot be done, sorry!
这篇关于在特定标签中打开链接 - 从电子邮件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!