Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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).




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?

Something like:

% not real code:
\ifJavascriptSupported{\tddate}{\today} % should show dynamic date in Acrobat, and static data in Evince


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): acroread

Evince (ugly red boxes): evince

Possible target (static data shown in Evince, similar to \today)

Evince target: evincetarget

share|improve this question
Note that testing for Acrobat is a bad idea because users may well have disabled (or not enabled) Javascript through preferences. –  cfr Mar 20 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 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 at 1:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.