# \goto

## Syntax (autogenerated)

 \goto{...}[...] {...} CONTENT [...] reference

## Description

This command creates a clickable link (or just normal text when interaction is not enabled). It takes two arguments, the first in curly braces is the text, the second in square braces is the label to link to.

You should not normally have to use this command. Links are better made using \in or \at, which are more conceptual (and lookup the section or page number as well).

If you want to implement some custom command for building links, this command is useful. You might also want to use the \ref command for getting the raw page number, section number, section title, etc.

## Examples

\reference[label:1]{Some text}
\page[yes] % Insert page break

\goto{Wiki}[url(http://wiki.contextgarden.net)]
\goto{Email}[url(mailto:spam@example.com)]

\goto{Other page}[page(3)]

### Open files or programs:

\goto{Start}[program(test.tex)]

By enclosing \goto’s destination in program(#1) you have some means of launching files or programs.

Of course, this is a security issue.

However, PDF readers seem to handle this inconsistently.

The following test.tex will attempt to open itself. Notice that per default PDF readers stay in the current working directory.

\setupinteraction[state=start]
\starttext
\goto{A file}[program(test.tex)]\par                    % case 1: destination specified
\goto{A command}[program(/usr/bin/kwrite test.tex)]\par % case 2: program and destination specified
\stoptext

### Behavioural study of PDF viewers

This comparison was made on Linux/x86 and OSX 10.9.5 (replacing /usr/bin/kwrite test.tex with /Applications/Preview.app test.pdf). YMMV.

acroread 9.2, Linux/x86 Case 1 succeeds. Runs the associated mime type application on the argument.

Case 2 results in a file error.

Acrobat Reader DC 2017.009, OSX Case 1 succeeds after asking back. Runs the default application for .tex files.

Acrobat Pro 9.5.5, OSX Case 1 succeeds after asking back. Runs the default application for .tex files.

okular 0.11.2, Linux/x86 Case 1 succeeds. Runs the associated mime type application on the argument.

Case 2 fails. Note that calling an executable (without the file argument) will be prevented by Okular for safety reasons.

xpdf 3.02, Linux/x86 Case 1 fails.

Case 2 succeeds: Xpdf allows execution of arbitrary commands in a shell with user privileges.

Google Docs as of 2010-10-24 Case 1 fails.

Case 2 fails.

mupdf 7.2, Linux/x86 Case 1 fails.

Case 2 fails.

Preview.app 7.0, OSX Case 1 fails (nothing happens).