I am embedding links to an UR in my documents. Although it is used in XML-documents, you might be able to use the gist of this code that generates a clickable link. Perhaps you find it useful. 

dr. Hans van der Meer

% Return the code when clicking the link.
\def\URIReturnCode#1{\ctxlua{tex.print(hvdm.urireturncode("#1"))}}

— Some Lua code needed:
-- Check URI

socket.http.TIMEOUT = 5 -- set URI timeout in seconds
hvdm.urireturncode = function (theuri)
-- Differentiate between file and http protocols.
local first,last = string.find(theuri, "file://")
if first == nil then
-- We have http to search for.
local content, status, authinfo = socket.http.request{
method = "HEAD",
url = theuri,
}
return type(status) == "number" and status or "failure"
else
-- We must ascertain the existence of the file.
local thefile = io.open(string.sub(theuri, last+1, -1), "r")
if thefile then
io.close(thefile)
return "200"
else
return "404"
end
end
end

% ..... Place an url link .....................................................

% BEWARE: spaces in file names must be %20 in the link !!!

% This global definition of the URLbase cannot be missed.
\def\THEURLBASE{http://}

% Signal the occurence of timeout on URI search.
\newif\ifURItimeout

\startxmlsetups xmlcommon:urlbase
\edef\THEURLBASE{\xmlstrippednolines{#1}{.}}

% Reset the URI timeout for new URLbase.
\global\URItimeoutfalse
\stopxmlsetups

\startxmlsetups xmlcommon:url

% Define the full uri.
\edef\theurl{\THEURLBASE\xmlatt{#1}{link}}

% File suffix should be one of the list.
\doifelse{\FileSuffixList{\xmlatt{#1}{link}}
{pdf,jpg,jpeg,html,png,tif,tiff}}{\empty}
{\def\suffix{.impossible}}% no suffix from the list here
{\def\suffix{\empty}}% one of the list is present

% First try link as given, beware of unreachable site.
\ifURItimeout
% For previously timeout on this site.
\else
\edef\returncode{\URIReturnCode{\theurl}}
\doif{\returncode}{failure}
{
\global\URItimeouttrue
\errorcall{#1}{url access fails for \THEURLBASE\xmlatt{#1}{link}}
}
\fi

% On URI timeout there is no hope to find the file.
\ifURItimeout
\else
% When there is no suffix from the list, try several.
\doifnot{\suffix}{\empty}
{
\scratchcounter=200\relax
\ifnum\returncode=\scratchcounter\else
\def\suffix{.pdf}
\edef\returncode{\URIReturnCode{\theurl\suffix}}
\fi
\ifnum\returncode=\scratchcounter\else
\def\suffix{.jpg}
\edef\returncode{\URIReturnCode{\theurl\suffix}}
\fi
\ifnum\returncode=\scratchcounter\else
\def\suffix{.jpeg}
\edef\returncode{\URIReturnCode{\theurl\suffix}}
\fi
\ifnum\returncode=\scratchcounter\else
\def\suffix{.html}
\edef\returncode{\URIReturnCode{\theurl\suffix}}
\fi
\ifnum\returncode=\scratchcounter\else
\def\suffix{.png}
\edef\returncode{\URIReturnCode{\theurl\suffix}}
\fi
\ifnum\returncode=\scratchcounter\else
\def\suffix{.tiff}
\edef\returncode{\URIReturnCode{\theurl\suffix}}
\fi
\ifnum\returncode=\scratchcounter\else
\def\suffix{.tif}
\edef\returncode{\URIReturnCode{\theurl\suffix}}
\fi
}

% Give up if returncode other then 200.
\ifnum\returncode=200\relax
% Page number might be added.
\doifelse{\xmlatt{#1}{page}}{\empty}
{\let\thep\empty}
{\edef\thep{\letterhash page=\xmlatt{#1}{page}}}

% Place the link, ref-attribute prevales in the presentation.
\doifelse{\xmlatt{#1}{ref}}{\empty}
{\edef\temp{\xmlatt{#1}{link}}}
{\edef\temp{\xmlatt{#1}{ref}}}
\goto
{\FirstLastCharacters{\temp}{\xmlatt{#1}{maxsize}}}
[url(\theurl\suffix\thep)]
\else
\errorcall{#1}
{\THEURLBASE\xmlatt{#1}{link} not found (\returncode)}
\fi

\fi % end of URItimeout
\stopxmlsetups


On 8 Oct 2018, at 00:39, Hans Hagen <j.hagen@xs4all.nl> wrote:

On 10/7/2018 8:41 PM, Pablo Rodriguez wrote:
On 10/7/18 8:33 PM, Hans Hagen wrote:
On 10/7/2018 8:19 PM, Pablo Rodriguez wrote:
[...]
Is there a way to hyperlink to an attached document? I mean, no matter
whether it has been generated by ConTeXt or not.
i have no clue what you mean
Is there a way to link to a page or a destination (such as in
https://www.adobe.com/content/dam/acom/en/devnet/pdf/PDF32000_2008.pdf#page=500
or
https://www.adobe.com/content/dam/acom/en/devnet/pdf/PDF32000_2008.pdf#nameddest=G12.2456615)
to a document that is attached (using \attachment) in ConTeXt?
I hope it is clear now,
it points to the media mess .. which relates to either or not obsolete stuff (flash related)

anyway, i don't know as i never embed pdf docs and if i would i'd have no reason to refer to them (it probably depends on a viewer extracting the attachment, caching it and then providing access: it makes no sense to waste time on features that are not supported or maybe only by acrobat unless it's a well paid projects in which case throw away code is a bit less waste of time because it brings foon on the table)

Hans

-----------------------------------------------------------------
                                         Hans Hagen | PRAGMA ADE
             Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________