# Alternative text for Javascript (form) boxes for viewers that don't support Javascript?

I am using the tdclock package to display the current date and time. In looks pretty good in Acrobat, but in other viewers (like Evince) it looks terrible because they don't support Javascripts and instead they show a red box (see below).

\documentclass{article}
\usepackage{tdclock}
\begin{document}
\initclock

Date: \tddate

\end{document}


Is there a way to conditionally use one rendering or the other depending on whether one is using Acrobat to view the document. Or more specifically use one if Javascript is supported or another one if not?

Is something like this following posible?

\documentclass{article}
\usepackage{tdclock}
\begin{document}
\initclock
% not real code:
\ifJavascriptSupported{\tddate}{\today} % should show dynamic date in Acrobat, and static data in Evince
\ifJavescriptSupported{\tdchorno}{}

\end{document}


Another way of interpret this question is to allow alternative text if the viewer doesn't support a feature (like media9 does). (If nothing else, even no text at all will be better than a red box.)

Here it is a comparison with Acrobat and Evince with the current code:

Acrobat (numbers typeset by Javascript, no TeX):

.

Evince (ugly red boxes):

.

Desired result in reader not supporting JS (static data shown in Evince, similar to \today)

-
Note that testing for Acrobat is a bad idea because users may well have disabled (or not enabled) Javascript through preferences. – cfr Mar 20 '14 at 1:23
@cfr, that is part of the question. If Javascript is disabled in Acrobat then an alternative (fallback) code would appear. media9 is able to do that (but for media not Javascript). – alfC Mar 20 '14 at 1:24
What I meant was, you need the test to be for JS. In your question, you suggested 2 possibilities: test for A; test for JS. I just meant only the second would really work. By the way, it fails in Okular, too. – cfr Mar 20 '14 at 1:35
The only way I can think to do this is using OCGs (optional content groups) which are unfortunately also not consistently implemented in all PDF viewers. – Paul Gessler Jan 11 at 2:53

This is a partial solution to the problem, which at least eliminates the ugly red box that is rendered in PDF viewers with no Javascript support (including Acrobat when has it disabled).

By chance I found a hidden option of hyperref here http://tex.stackexchange.com/a/79979/1871 called Fld@bordercolor.

\documentclass{article}
\usepackage{tdclock}

\makeatletter
\def\Fld@bordercolor{1 1 1} % set TextField border to white, there is also Fld@bcolor
\makeatother

\begin{document}
\initclock

Date: \tddate

\end{document}


The place of the date will show just empty space (almost, there are couple of slashes remaining) if Javascript is disabled.

-