[Tex/LaTex] How to stop opening new window in browser with hyperref


I wonder if there is any way to stop hyperref's \href{url}{text} command from opening a new window of a browser each time. What I mean is this. Suppose you use a web address for url, say, www.mywebsite.com/page.html. On a compiled PDF, you click on it, and it opens the website. Click on it again, or on another \href with the same address: it opens the same page with another window.

I would rather just come back to the page opened earlier.

Best Answer

hyperref does not open links (internal or external) and does not produce any code to open links. It only adds the information to the document, that an object, e.g., a text or image, is a link. If the program, that shows the document, is able to handle links, it does at least the analysis, if the link is an internal link, that means it is from one place of the document to another place at the same document, or if it is an external link, that means a link to another document or a place at another document.

If a link is an internal link, the program simply jumps to the destination, if you activate the link.

If the link is an external link, the program has three alternatives:

  1. It is able to handle the type of external document itself.
  2. It knows another program, that is able to handle the type of external document.
  3. It may ask the OS to handle the external document.

The third alternative is almost the same like the second (OS is a kind of program). So what about the first and the second alternative?

With the first alternative, it simply can open the external document and jump to the link destination at this document. In this case the program may either be able to detect, if the external document is already open, and simply bring it to the foreground and jump to the destination. But some programs may even not be able to do this and will always open a new instance of the external document. Some programs may be able to allow the user to configure how they should handle links to external but already opened documents. It's your turn to find out, how the programs you are using handle this.

With the second alternative, it my be easy for a program to find out, if there's already an instance of the program for the external document running. But it is not easy for the program to find out, how that other program may be asked, if the external document is already open. It is not easy to instruct the other program to bring that open document into foreground. It is not easy to instruct the other program to jump to a link at the already opened document. It is easy to call a new instance with one argument: the external link.

A simple example of the problem is: For simple cooperation with the PDF viewer TeXnicCenter users have not only to reconfigure their editor if they switch, e.g., from Acrobat Reader to BlinkyBill, but even if they switch from Acrobat Reader 8 to Acrobat Reader X.

A good solution would be, if every document viewer program could be configured to search for already running instances of itself and instruct this instance to open the link. But not every program can be configured to do this.

Conclusion: The idea is nice, but it needs cooperation of several different programs and is nothing hyperref could handle or something that may be handled from document source code. It's more or less a problem of which programs you are using and what features these programs support.

Related Question