Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Links in PDF containing # not working in Safari

We are trying to include a link that contains the character '#' in a PDF. 

 

The link is https://pmlib.org/cuentame-tu-historia/#top

 

Links appear correct in Acrobat, and work in Chrome and Edge. 

 

However, in Safari, when you click on the link in the PDF, it renders it as "https://pmlib.org/cuentame-tu-historia/%23top" and gives back a 404 error. 

 

Anchor links do usually work in Safari (when accessed from the website or from the body of an email).

 

Does anyone know what causes this or how we could fix it?

iPad Air 2, iPadOS 13

Posted on Jun 19, 2020 1:56 PM

Reply
Question marked as Best reply

Posted on Jun 20, 2020 12:21 PM

Had a chance to try your PDF directly out of Acrobat DC Pro. All worked in Safari, with the minor exception the last two both said the connection wasn't private, so I didn't follow those through. But the first two had no problem at all.


However, if I open the same PDF in Preview and then try the links, the first two only partially load in Safari with this error as part of the page rendering:



So I'd have to say Preview is doing something wrong when passing the link to Safari. Which isn't exactly surprising since Preview is always behind the current PDF standards.


6 replies
Question marked as Best reply

Jun 20, 2020 12:21 PM in response to tabrarian

Had a chance to try your PDF directly out of Acrobat DC Pro. All worked in Safari, with the minor exception the last two both said the connection wasn't private, so I didn't follow those through. But the first two had no problem at all.


However, if I open the same PDF in Preview and then try the links, the first two only partially load in Safari with this error as part of the page rendering:



So I'd have to say Preview is doing something wrong when passing the link to Safari. Which isn't exactly surprising since Preview is always behind the current PDF standards.


Jun 22, 2020 7:34 AM in response to tabrarian

What ever placed the reference link in your PDF document was enforcing RFC3986 and converting the reserved (#) character to the replacement string %23. See Percent_Encoding. Any internal change of the destination page could also adversely affect the URL anchor reference from working at all.


I just exported a Pages document to PDF (without) the percent encoding, and here is what I see inside the PDF:



No conversion to %23. This link works correctly from Preview, or when the PDF is opened directly in Safari — the browser is not performing any percent encoding on the link, and it is opened to its anchor (#) location on the target site.


When I deliberately change the Page's URL to one with a %23 encoding for the '#' character, and export to PDF, that PDF has the following string in it:



The URL is changed from what was entered in Page's Link Editor to the normal URL with identical results to the previous.

Jun 19, 2020 3:21 PM in response to Kurt Lang

Sorry to be unclear -- the link itself does work in Safari when I type it directly or click on it from the body of an email. It is an issue specifically when the link is within a PDF of the # changing to %23. Other links in the PDF (that don't have the # symbol) work fine.


The links in the PDF work fine on Chrome/Edge, but when it tries to open in Safari only it has this error.


I think it is possibly an issue with the Safari PDF viewer?


This is Safari for iOS (I don't think extensions are available). My coworkers are experiencing the same issue on their devices.

Links in PDF containing # not working in Safari

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.