Copy link to clipboard
Copied
Yes, I'm still using CS6, because I publish print books that are as old as Aldus Freehand, so I have everything back to Aldus Freehand. Here's my question. Whenever I try to link to an URL that ends with a "/?p=", InDesign adds a bunch of characters that the causes the hyperlink to get a 'not found' error message.
Please see my attached image.
Any url I enter with "?p=" adds the extra characters in the InDesign hyperlink text windows and doesn't forward the designated url. I 've tried editing and deleting the hyperlinks, sharing the hyperlinks, but any URL with a PID adds the characters I can't edit out using the hyperlink windows. This is what I found: "Originally “#” was used as an anchor to jump to an element with the same name/id. However, nowadays it's usually used with AJAX-based pages since changing the hash can be detected using JavaScript and allows you to use the back/forward button without actually triggering a full page reload."
I'd appreciate any step-by-step suggestions on how to get rid of those additional characters in an InDesign hyperlink?
Mike - Delving further into your link, I discovered a great fix: change the characters using tiny.url etc. It worked. Thanks for the link!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thanks for the link, but it is unusable for me. In other words, it cannot be corrected by a print designer. My expertise is making digital CMYK 300 dpi images and K/O text print like pics on 60# text and 100#C1S.
//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.destination.destinationURL);
var newDestName = decodeURI(allHyperlinks.destination.name);
allHyperlinks.destination.destinationURL = newDestURL;
try{
allHyperlinks.destination.name = newDestName;
}catch(e){};
Copy link to clipboard
Copied
Mike - Delving further into your link, I discovered a great fix: change the characters using tiny.url etc. It worked. Thanks for the link!
Copy link to clipboard
Copied
Hi spotte,
don't know if my script will help you at all.
However, the code you copied over is faulty, because:
[1] the post you copied the code from was damaged at the end of 2019 when the thread was moved to this new InDesign forum. That happened to a lot of posted scripts that were posted before October or November 2019.
[2] you did not copy all of the code.
Let's see if I can correct this:
//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()"
And I hope, it's OK for you if I give your other reply the "Correct Answer".
The one you mentioned tiny.url …
Regards,
Uwe Laubender
( ACP )