Ensuring PDF hyperlinks open in a new tab or window in ALL browsers
Hello. I previously posted this in InDesign support but now it's for Acrobat. I followed the advice below (thanks senrab75) to ensure my PDF links – when open in a browser – open in a new tab/window. This worked beautifully in Firefox but not in Chrome or Safari – same for most. According to Windows users, it worked in IE. Any advice?
Also, it's ok to do the below in a small document but – as a lot of people noted in the previous chat – when it's a large document with multiple links, it is tedious. Would be great if Adobe developers could add this feature to all their design programmes when creating hyperlinks...
Thank you.
From senrab75 :
In Adobe Acrobat (the application, not the .pdf reader) use the Link Tool to edit the hyperlinked text object. Remove the “Open a web link” action assigned by default to handle the hyperlinked text when clicked. Assign a new action to the linked text that will open the hyperlink in a new window.
Note: The links have to be established each time you create a PDF – they do not carry over from In Design or any other software.
- Access the Link tool (Tools > Advanced Editing > Link Tool)
- Right click on the hyperlinked text and select Properties
- In the Link Properties dialog box click on the Actions tab
- In the middle of the Actions panel in the Actions section click on the Open a web link action listed there to select it.
- Click the Delete button located just below that section in the lower right corner. This removes the action from the list and the Actions section should now be empty.
- In the Add an Action section right above the Actions section click on the Select Action drop down menu and select the Run a JavaScript action from the list.
- Click the Add… button.
- In the JavaScript Editor that opens up, click your cursor in the Create and Edit JavaScripts area, like you would in a word processor to begin typing, and type the following line:
app.launchURL("http://www.MySampleURL.com/someFolder/somePage.html", true);
- Change the hyperlink text between the quotation marks to your desired URL.
Ex: app.launchURL("http://www.cnn.com", true);
Caution:
- The code is case sensitive so make sure you typed app.launchURL NOT app.launchurl or some other case combination.
- Make sure that you have quotation marks around your hyperlink URL.
- Make sure there is a semicolon at the end of the line of code you just typed.
- Make sure that the quotation marks are straight up and down – not on an angle.
- Click OK to close the JavaScript Editor dialog box.
- Click OK to close the Link Properties dialog box.
- Save the .pdf and test your .pdf hyperlink by opening the .pdf document in a browser, click the link and check to see that it opens in a new browser window.
