Skip to main content
Inspiring
June 2, 2012
Answered

CS6 hyperlink problem

  • June 2, 2012
  • 13 replies
  • 70385 views

Hi everyone,

 

In Indesign CS6, I created a new URL hyperlink and pasted the following link into the field:

http://law.ato.gov.au/atolaw/view.htm?docid=AID/AID2004688/00001

But when I click OK and then look in the URL field in the hyperlinks panel, I see that Indesign has changed the link to the following:

http://law.ato.gov.au/atolaw/view.htm%3Fdocid%3DAID/AID2004688/00001

Notice how it's swapping out the question mark (?) after .htm with %3F.

It's also swapping out the equals sign (=) with %3D.

This breaks the URL and makes it no longer workable.

I tried reinstalling Indesign but the problem still remains.

I wondered if anyone knows why this is happening and whether there's a workaround?

Appreciate any help.

    This topic has been closed for replies.
    Correct answer Laubender

    @gwhPoster – That seems to be an encoding problem. Do you use a prerelease beta version of InDesign CS6?

     

    Background:
    It seems that every URL that is filled in in the Hyperlink palette is encoded with something like encodeURI() (a global ExtendScript function):

    string encodeURI (text: string)

    Encodes a string after RFC2396.

    Create an UTF-8 ASCII encoded version of this string. The string is converted into UTF-8. Every non-alphanumeric character is encoded as a percent escape character of the form %xx, where xx is the hex value of the character. After the conversion to UTF-8 encoding and escaping, it is guaranteed that the string does not contain characters codes greater than 127. The list of characters not to be encoded is -_.!~*'();/?:@&=+$,#. The method returns false on errors.

     

    To get it back to a working URL we could decode it by "decodeURI()":

     

    string decodeURI (uri: string)

    Decodes a string created with encodeURI().

     

    To correct that you could use the following script (JavaScript).

    (After running the script don't go to "Hyperlink options…" in the Hyperlink panel and hit "OK" since the URL is converted back and you have to run the script again to correct that!)

     

    //DecodeURI_AllHyperlinks_DestinationURL_Name.jsx
    //DESCRIPTION:Decodes all hyperlink destination URLs and names; can be undone in one go!
    //Uwe Laubender
    
    /**
    
    * @@@BUILDINFO@@@ DecodeURI_AllHyperlinks_DestinationURL_Name.jsx !Version! Mon Jun 04 2012 14:48:49 GMT+0200
    
    */
    
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
    
    app.doScript
    (
    	_DecodeURI_AllHyperlinks_DestinationURL_Name , 
    	ScriptLanguage.JAVASCRIPT, 
    	[] , 
    	UndoModes.ENTIRE_SCRIPT, 
    	"Decode all hyperlink URLs and names"
    );
    
    
    function _DecodeURI_AllHyperlinks_DestinationURL_Name()
    {
    
    	var d = app.documents[0];
    	var allHyperlinks = d.hyperlinks;
    
    	for(var n=0;n<allHyperlinks.length;n++)
    	{
    
    		var newDestURL = decodeURI( allHyperlinks[n].destination.destinationURL );
    		var newDestName = decodeURI( allHyperlinks[n].destination.name );
    
    		allHyperlinks[n].destination.destinationURL = newDestURL;
    
    		try{
    		allHyperlinks[n].destination.name = newDestName;
    		}catch(e){};
    
    	};
    
    }; //END function "_DecodeURI_AllHyperlinks_DestinationURL_Name()"
    

     

    Hope that helps.

    Uwe

     

    IMPORTANT NOTE:

    The code above was damaged before. Why? This happened at the end of 2019 when this thread was moved over from the old InDesign forum to this new InDesign forum. A lot of script code from a lot of threads were affected back then. I corrected the code now.

     

    Regards,
    Uwe Laubender

    ( ACP )

    13 replies

    spotte10353908
    Inspiring
    December 23, 2020

    Is anyway for ADOBE to fix this Adobe product bug? This Adobe's issue to fix. And this is a big problem for print designers. 

    Participant
    January 16, 2014

    Use bit.ly to shorten the URL to something containing no special characters.

    spotte10353908
    Inspiring
    December 23, 2020

    dave_feasey:  Seven years later!

     

    Brilliant answer. Simple and to the point. Good thinking. Thank you!!

    Participant
    November 19, 2013

    I have had this same problem. A lot of the fixes posted here are over my head. I don't know what to do with a script.

    I just pasted a bit.ly link in instead of the longer link that kept bugging up. It worked like a charm and is by far the simplest solution I've found so far.

    Hope this works for everyone.

    Zinusmero
    Participant
    October 2, 2013

    I have just encountered this problem but have found a non-scripting solution that works (for me anyway).

    I often have to link pages to a website containing a ? and = sign.

    This is what i do:

    1. Highlight the text where you want the hyperlink.
    2. Create a Hyperlink Destination.
    3. Select URL from the Type Combo Box.
    4. Enter a destination name and URL and Click OK. The selected text by default will be the Destination Name.
    5. While the text is still selected, create a New Hyperlink.
    6. In the Link To combo box, select Shared Destination.
    7. In the Name combo box, select the name of the destination you just created.
    8. Click OK.

    The URL will now be ok without the special characters.

    I have tested this method in an exported PDF and it worked fine.

    On a side note...(sarcastically) Thanks Adobe for all the extra work you have given me, I was getting bored with things being so uncomplicated.

    Peter Spier
    Community Expert
    Community Expert
    October 2, 2013

    It looks like maybe the this is actually fixed in the 8.0.2 update released the other day. See item one in the list of fixes at http://helpx.adobe.com/indesign/release-note/indesign-cs6-2-release-notes.html

    Inspiring
    April 22, 2013

    I started a thread (http://forums.adobe.com/message/5256788#5256788) about a similar problem I was having, being unaware of this thread. The "$" in the link below causes InDesign to go to the wrong destination, but the link works in an exported PDF.

    http://www.projectorcentral.com/paint_perfect_screen_$100.htm

    Participating Frequently
    April 22, 2013

    Many thanks to gwhPoster to mitigate this horrid ID6 bug. Wasn't until a reader called to my attention that a pdf "live link" wasn't working that I realized this problem a couple of months ago. So great to have people to fix these things.

    After saving this to txt file, since I'm not a java programmer, I just copied the .txt file to the scripts: Java scripts: directory in ID, changed the suffix from .txt to .jsx & it works like a charm. Thanks so much! And I did report it as a bug. a big bug.

    MGKD

    TonyRedhead
    Participating Frequently
    April 22, 2013

    I find it amazing that it's been almost eight months since this bug was first reported in this forum and still no fix . We use this feature everyday and if it wasn't for the fixes supplied by actual users of InDesign we would be in dire shape.

    Participating Frequently
    April 22, 2013

    And I didn't read anywhere that one needed to change the suffix from .txt to .jsx. At least that's what I had to do to get ID scripts to recognize it as a java script.

    Martha Dibblee

    dibblee@hevanet.com

    Participant
    February 22, 2013

    Hi, I just found a work-around. Use a url-shortener like http://ow.ly/url/shorten-url (I created mine through my hootsuite dashboard). The links do not become relative, they work in browsers and mobile and all of our piwik code remains intact!

    Participant
    January 3, 2013

    Hi. I've had the exact problem. Any link with JSP? included gets changed when you add it into the "edit" panel, and won't work.

    I came here looking for help, but I have no idea how to run a script on an ID file. So I tried one more thing. If you paste the url into the top part of the links panel, with the "link" name hilighted, it will work! Adds an extra step, but it worked.

    They need to fix this soon!

    Community Expert
    January 4, 2013

    … but I have no idea how to run a script on an ID file.


    @debschuller – see the following blog post:

    http://indesignsecrets.com/how-to-install-scripts-in-indesign.php

    Both scripts presented here, in #51 the enhanced version by Joe Fugate and my original one in #2, are JavaScript (ExtendScript). All the lines should be copied to a plain text file and saved with  .jsx at the end of the file name.

    What might be interesting to you as well:

    http://indesignsecrets.com/javascript-for-the-absolute-beginner.php

    And yes, Adobe should fix this soon.
    It's quite a while this bug is known…

    Uwe

    Participant
    January 4, 2013

    @debschuller – good discovery. Yes, the hyperlink edit box above the link does indeed work properly.

    It's just the hyperlink dialog box that encodes the links and in the process breaks them.

    I'm amazed that Adobe has let this bug persist for as long as they have. Seems like it would be a simple fix if they would just give it a few hours of attention.

    Participant
    October 22, 2012

    I just spent 4 hours on Adobe tech support for this very issue.  They told me that it is a bug and that it should be fixed in the next update.  Thier workaround was to paste your link into notepad first and then copy/paste from notepad to your InDesign document......I hope it works!

    Participant
    October 29, 2012

    Pasting into Notepad did NOT work for me. Yes, I then copied from Notepad. Still includes the stupid extra characters. Have tried many, many times.

    Glad that Adobe sees this as a bug. The update to fix it can't come soon enough.

    While the script mentioned earlier may very well work, it is way more than I want to do to solve a bug.

    Community Expert
    October 30, 2012

    While the script mentioned earlier may very well work, it is way more than I want to do to solve a bug.

    @fostercoburn – I'm aware the script is an intermediate solution.

    But if I have to fix hundreds of hyperlinks, I'd certainly try it out.

    In that case to copy a link from the browser to Notepad and then on to InDesign is no solution.

    See #30 in this thread:
    http://forums.adobe.com/message/4591559#4591559

    Uwe

    Participant
    August 22, 2012

    Hello! I also am having this problem. I tried running both of the suggested scripts; however, I get the following JavaScript error: Error Number 55. Error String: Object does not support the property or method 'destinationURL'

    Does anyone have an idea how to make the script work? I'm using CS6, Version 8 on Windows 7.

    Thanks in advance!!!

    Community Expert
    August 22, 2012

    @almostlindy – can you give me an example of the URL or target link you are using?

    Uwe

    Community Expert
    August 22, 2012

    I have to see into this and maybe expand the script.

    There are several destinations for Hyperlinks:

    HyperlinkExternalPageDestination

    HyperlinkPageDestination

    HyperlinkTextDestination

    HyperlinkURLDestination

    ParagraphDestination

    Don't know, if all those types are buggy…

    Uwe