Skip to content Skip to sidebar Skip to footer

Opening Links In A Specific Tab - From An Email

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

Solution 1:

You can name your current window/tab with a JavaScript assignment:

<scripttype="text/javascript">this.name = "mainWindow";
</script>

Then you use that name as value for the target attribute in links, like

<ahref="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:

  1. If target window/tab `mainWindow` has already been opened, focus it, perform activation there, and close ourselves.
  2. 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!

Post a Comment for "Opening Links In A Specific Tab - From An Email"