7 Replies Latest reply on Aug 5, 2013 11:42 PM by Laubender

    Why does indesign escape my hyperlinks?

    NViereckel

      I need to create a couple of pdf invites that have a lot of similar information. And whilst most hyperlinks work OK any that have a ? in it indesign converts to another url and it doesn't work. See below

      Yes I have found I can put them in at the pdf stage, but when client keep changing information it is frustrating that I need to apply them each time.

      Any information on how to stop this happening would be great.

      Cheers

      Nikola

       

      original .../BookingRetrieve.aspx?ID=155964

      after I place in indesign  .../BookingRetrieve.aspx%253FID%253D155964

        • 1. Re: Why does indesign escape my hyperlinks?
          Salah Fadlabi Level 5

          Select the hyperlink on the Hyperlink panel then go to Hyperlink Destination Options>Edit then copy the correct hyperlink and paste into URL box.

          hyperlink.jpg

          • 2. Re: Why does indesign escape my hyperlinks?
            Peter Kahrel Adobe Community Professional & MVP

            This is a reported bug in InDesign. It happens when you create a URL hyperlink using New Hyperlink -- when you create a link using New Hyperlink from URL it doesn't happen. To fix URLs in a document, you can use this script:

             

            var URLs = app.documents[0].hyperlinkURLDestinations.everyItem().getElements();
            for (var i = URLs.length-1; i > -1; i--){
                URLs[i].name = decodeURI(URLs[i].name)
                URLs[i].destinationURL = decodeURI(URLs[i].name);
            }
            

             

            Peter

            • 3. Re: Why does indesign escape my hyperlinks?
              vectorbabe Level 1

              Don't create them using the New Hyperlink Destination command in the panel menu.

               

              Try pasting the link in the little field at the top of the panel.

              --

              Sandee Cohen

              Computer Graphics Trainer

              • 4. Re: Why does indesign escape my hyperlinks?
                Electroscribe_2015 Level 1

                Attempted to create a script but got this error:

                var URLs = app.documents[0].hyperlinkURLDestinations.everyItem().getElements();

                 

                original post:

                var URLs = app.documents[0].hyperlinkURLDestinations.everyItem().getElements();

                for (var i = URLs.length-1; i > -1; i--){

                    URLs[i].name = decodeURI(URLs[i].name)

                    URLs[i].destinationURL = decodeURI(URLs[i].name);

                • 5. Re: Why does indesign escape my hyperlinks?
                  Laubender Adobe Community Professional & MVP

                  @Peter – I wonder why you are using the value for the "name"-property of the hyperlinkURLDestination for two different things:

                   

                  1. The "name"
                  2. The "destinationURL"

                   

                  As we can see in the screenshot provided by Salah in answer #1, one can change the name and leave the URL intact (whatever the reason to do so might be).

                   

                  So I think would be better to use the decodeURI() method on both, the "name" and the "URL" like that:

                   

                  var URLs = app.documents[0].hyperlinkURLDestinations.everyItem().getElements();
                  
                  for (var i = URLs.length-1; i > -1; i--){
                  
                      URLs[i].name = decodeURI(URLs[i].name);
                      URLs[i].destinationURL = decodeURI(URLs[i].destinationURL);
                  
                  };
                  

                   

                  Uwe

                  • 6. Re: Why does indesign escape my hyperlinks?
                    Peter Kahrel Adobe Community Professional & MVP

                    Uwe,

                     

                    I never thought about it like that. You're probably right, but that script works fine for me as it is. decodeURI(URLs[i].destinationURL) probably returns a string, so it may well be the case that we're actually doing the same thing. Will try your version.

                     

                    Peter

                    • 7. Re: Why does indesign escape my hyperlinks?
                      Laubender Adobe Community Professional & MVP

                      @Peter –  If one is creating a fresh hyperlink, the values of "name" and  "destinationURL" of hyperlinkURLDestination are the same. Both values are of type "string" (according to Jongware's DOM documentation).

                       

                      Your script will work in every case the user will not change the "name" property in the "Hyperlink Destination Options". Why one should do that, I don't know. But in case, it's better to decode  "destinationURL" independently from "name".

                       

                      Uwe

                       

                      //EDIT:  "of hyperlinkURLDestination" added.

                       

                      Message was edited by: Laubender