It is a difficult unsolved issue; pdfTeX uses a heuristics to find the right boxes that belongs to the link. It depends on the order of the boxes, the nesting level and the position. The following example modifies LaTeX's \@outputpage to move the header and footer boxes out of the way to fool pdfTeX's heuristics.
\documentclass{article}
\usepackage{fancyhdr}
\fancyhead[c]{HEADER}
\fancyfoot[c]{FOOT}
\pagestyle{fancy}
\usepackage{hyperref}
\makeatletter
\def\@outputpage{%
\begingroup % the \endgroup is put in by \aftergroup
\let \protect \noexpand
\@resetactivechars
\global\let\@@if@newlist\if@newlist
\global\@newlistfalse
\@parboxrestore
\shipout \vbox{%
\set@typeset@protect
\aftergroup \endgroup
\aftergroup \set@typeset@protect
% correct? or just restore by ending
% the group?
\if@specialpage
\global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
\fi
\if@twoside
\ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
\let\@themargin\oddsidemargin
\else \let\@thehead\@evenhead
\let\@thefoot\@evenfoot \let\@themargin\evensidemargin
\fi
\fi
\reset@font
\normalsize
\normalsfcodes
\let\label\@gobble
\let\index\@gobble
\let\glossary\@gobble
\baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
\@begindvi
\vskip \topmargin
\moveright\@themargin \vbox {%
\setbox\@tempboxa \vbox to\headheight{%
\vfil
\color@hbox
\normalcolor
\hb@xt@\textwidth{\@thehead}%
\color@endbox
}% %% 22 Feb 87
\dp\@tempboxa \z@
%%% begin head
% \box\@tempboxa
%%% replaced by:
\moveright\paperwidth\rlap{%
\rlap{\kern-\paperwidth\box\@tempboxa}%
}%
%%% end head
\vskip \headsep
\box\@outputbox
\baselineskip \footskip
%%% begin foot
% \color@hbox
% \normalcolor
% \hb@xt@\textwidth{\@thefoot}%
% \color@endbox
%%% foot replaced by
\setbox\@tempboxa=\hbox{%
\color@begingroup
\normalcolor
\hb@xt@\textwidth{\@thefoot}%
\color@endgroup
}%
\moveright\paperwidth\rlap{%
\rlap{\kern-\paperwidth\box\@tempboxa}%
}%
%%% end foot
}%
}%
\global\let\if@newlist\@@if@newlist
\global \@colht \textheight
\stepcounter{page}%
\let\firstmark\botmark
}
\makeatother
\begin{document}
\href{http://www.dante.de/}{Hello\newpage\noindent World}
\end{document}
The link around the footer and header line are still present but outside the page area:
/MediaBox [0 0 612 792] % page 1 and 2
/Rect [147.716 656.239 478.476 665.15] % page 1, "Hello"
/Rect [744.772 84.782 746.765 98.73] % page 1, "FOOTER"
/Rect [744.772 691.108 746.765 705.056] % page 2, "HEADER"
/Rect [132.772 656.239 161.359 665.15] % page 2, "World"
If figures and footnotes are added:
\begin{document}
\footnote{A footnote}
\begin{figure}[b]\centering Figure bottom\caption{Figure A}\end{figure}
\href{http://www.dante.de/}{Hello\newpage\noindent World}
\begin{figure}[t]\centering Figure top\caption{Figure B}\end{figure}
\end{document}
then in this instance, the figures are not converted into links, but the footnote is a link. The latter could be caught by redefining \@makecol:
\gdef \@makecol {%
\ifvoid\footins
\setbox\@outputbox \box\@cclv
\else
\setbox\@outputbox \vbox {%
\boxmaxdepth \@maxdepth
\unvbox \@cclv
\vskip \skip\footins
\color@begingroup
\normalcolor
\footnoterule
%%% original:
% \unvbox\footins
%%% modified:
\moveright\paperwidth\rlap{%
\kern-\paperwidth\box \footins
}%
%%%
\color@endgroup
}%
\fi
\let\@elt\relax
\xdef\@freelist{\@freelist\@midlist}%
\global \let \@midlist \@empty
\@combinefloats
\ifvbox\@kludgeins
\@makespecialcolbox
\else
\setbox\@outputbox \vbox to\@colht {%
\@texttop
\dimen@ \dp\@outputbox
\unvbox \@outputbox
\vskip -\dimen@
\@textbottom
}%
\fi
\global \maxdepth \@maxdepth
}
However, putting free vertical material (\unvbox) into a fixed box is not side-effect free, if the \@cclv is again \unvboxed. Thus it fast becomes ugly. And patching base macros of LaTeX output routine raises compatibility issues with other packages that also deals with the output routine.
:-(– egreg Apr 20 '14 at 16:20