Skip navigation
NViereckel
Currently Being Moderated

Why does indesign escape my hyperlinks?

Aug 4, 2013 9:42 PM

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

 
Replies
  • Currently Being Moderated
    Aug 5, 2013 12:03 AM   in reply to NViereckel

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2013 1:08 AM   in reply to NViereckel

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2013 4:00 AM   in reply to NViereckel

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2013 8:52 AM   in reply to Peter Kahrel

    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);

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2013 9:28 AM   in reply to Peter Kahrel

    @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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2013 3:13 PM   in reply to Laubender

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2013 11:42 PM   in reply to Peter Kahrel

    @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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points