6

I suspect I'm out of luck on this one, but here goes...

Say I have a CHM help file that has http:// hyperlinks embedded in the help pages. When the user clicks on a hyperlink of the style:

<a href="http://www.example.com" target="_blank">click here!</a>

a browser window is opened and the target web page is displayed. If a browser is already open a new tab is created and the target displayed in that. If the user clicks on another link (or the same link) another browser window/tab opens, and so on.

Is there any way I can force all clicks of the links to go to the same tab/browser window?

Bryan Agee
  • 367
  • 3
  • 14
rossmcm
  • 1,576
  • 5
  • 34
  • 59
  • No. least, not with anything I am aware of. – soandos Jun 30 '11 at 03:54
  • 4
    Have you tried a different `target` name? I'm not on a Windows right now (and know nothing about CHM files), but `target="foo"` in a browser opens a new tab/window the first time, and opens subsequent links in that same window, as it implicitly receives that target name. `_blank` is a special value that means "always open in new window". – Daniel Beck Jun 30 '11 at 04:00
  • 1
    I tested it in a simple html page, and it works! So I assume it would in a CHM file. – imtheman Jun 30 '11 at 04:15
  • I just tested it with Chrome - still opens each click in a new tab. – rossmcm Jun 30 '11 at 04:45
  • @soandos, @Peter - is this a browser-specific thing then? – rossmcm Jun 30 '11 at 04:52

2 Answers2

5

Change the value of the "target" parameter to something other than "_blank" (which is reserved by the standards for always opening a new page without a name).

The "target" parameter allows you to specify a name (I recommend using a name that does NOT begin with an underscore) to open the new window in. By using the same name in other Anchor REFerences (hyper-text links), that new window that was opened previously will simply be re-used (instead of opening a new window again).

Randolf Richardson
  • 14,634
  • 39
  • 52
  • 1
    Thanks @Randolf. It seems to work on IE8 but Chrome opens a new tab each time. – rossmcm Jun 30 '11 at 08:39
  • Internet Explorer 8 doesn't support this? It's a **standard feature that all web browsers are supposed to support**. Either there's something wrong with IE8 on your computer (most likely, and SpyWare is a logical culprit), or Microsoft has decided that the standards aren't important and decided not to implement this feature (this would cause a lot of problems, so I suspect that they wouldn't dare do this). – Randolf Richardson Jun 30 '11 at 18:44
  • Hi @Randolf. No, IE _does_ support it. Chrome doesn't appear to. – rossmcm Jul 01 '11 at 05:03
2

Instead of

target="_blank"

use

target="__blank"
zx485
  • 2,170
  • 11
  • 17
  • 24
Athira Das
  • 21
  • 1
  • 1
    While this may provide a solution, it would be good to mention *why* they should use one over the other. – Mokubai Jul 28 '21 at 11:39