0

Working on a project I have been added into and theres a few odd issues just starting to appear.

They use dynamic links to the car website AutoTrader. Before now, I had never heard of

target="_new" 

or after some looking the now valid

target="new"

Upon research, it appears that the "new" will search for a tab opened before using the new method and replace that tabs url with the new one.

For around a year, this was working fine. But in the last couple of days I have had reports that sometimes it works, but other times it opens up in a completely new window. This never used to happen.

We have not changed any code except moving to AWS... is this possibly something to do with AutoTrader? Not sure if a website itself could control this behaviour but I cant see it?

Any information on this or possibly how to always guarantee that the new clicked link will always open in the same tab?

Lovelock
  • 7,689
  • 19
  • 86
  • 186

1 Answers1

1

As stated here, neither new or _new are explicit keywords (reference 1 and reference 2). So, if you define target="new" the browser searches for an open tab with the name new. If one of these exists (in this window, tab or frame), the new link will be opened in exactly this tab. If there is none, the browser will open a new tab (or window) with the name new. (you could accordingly use any individual name (like @x3ro stated)) Everything of this is specified by the html-standard. If it does not work in a given browser, it is a bug or .. are .. you .. using Internetz Explorer xD?

You should try to gather individual error notes about the users browser configurations.

PS: I am aware, that this is not answering the question completely, but I think you are ok, with a quick summary. As @user2921557 said:

Any information on this or .. ?

EDIT: Added hints of @jukka-k-korpela, thx!

Community
  • 1
  • 1
Simon K.
  • 348
  • 1
  • 7
  • 24
  • This is probably all that can be said without seeing actual code where the problem appears. It is possible that the code uses similar-looking `target` values and authors expect them to be the same; but e.g. `target="new"` and `target="_new"` are distinct and independent. On the theoretical side, e.g. `target="new"` causes the link to open in a tab *or* window *or* frame with the name `new`, and if none exist, it opens a new tab or window and names it. But in modern browsers, this is typically about tabs. – Jukka K. Korpela Jan 22 '15 at 09:44
  • After some research I realise now that the target is just a name and not an actual keyword. I made this: http://dabblet.com/gist/c806328ddc22ff4f9e89 On PC's at our company this has suddenly started to work on random occasions. Sometimes the tab opens in the same, other times it doesn't. On my mac its also intermittent, but another developer in another location cannot break the system so its just something i'll have to keep an eye on to find out whats triggering it. Cant think of any logical reason for it not to work but thats one of the magical mysteries! – Lovelock Jan 22 '15 at 10:39
  • Having just visited that link, the links always open in the same tab. Yet 5 minutes ago they were not working. Its been working previously for employees for over 2 years and now not.. apparently telling them its magic wasn't the correct way to describe 'I cant fix it' – Lovelock Jan 22 '15 at 10:41