Insert web content dynamically (Javascript?)
Package media9
is an option.
This example displays latest FIFA news in a Flash-based RSS-Reader I found on the web. It is embedded in the footline of every slide in a beamer presentation. It doesn't seem to update the content, though. However, it is reloaded (with updated content) when moving to the next presentation slide (Acrobat Reader required).
\documentclass{beamer}
\usepackage{media9}
\setbeamertemplate{footline}{
\includemedia[
width=\paperwidth,height=0.1\linewidth,
activate=pageopen, deactivate=pageclose,
flashvars={rss=http://www.fifa.com/rss/index.xml},
url
]{}{http://rsstool.sanriotown.com/rssReader.swf}%
}
\begin{document}
\begin{frame}{Frame title}
Please concentrate on the slide content!
\end{frame}
\end{document}
↗Another example, uses SlideShow.swf
(also media9
) to display a life image loaded from the web.
One option is to use Lua to fetch data when the file is compiled. Then, set a batch script to recompile the TeX file every 30 seconds or so, and use a pdf reader that auto-refreshes the pdf file.
Here is an example (in ConTeXt) that fetches the current date and time at a specific location from a webserver, parses the returned XML file, and displays the result.
\enabledirectives[schemes.threshold=10] % Don't cache downloaded file for more than 10 sec
% I use earth tools as an example, which returns data in XML format.
\startluacode
thirddata = thirddata or {}
thirddata.url = "http://www.earthtools.org/timezone-1.1/40.71417/-74.00639"
function thirddata.getcurrenttime()
-- Fetch remote url and store it in a file. ConTeXt automatically caches the
-- file for a duration given by `schemes.threshold`
local filename = resolvers.getreadfilename("loc",".", thirddata.url)
-- Read the file for data
local xmldata = xml.load (filename)
-- Parse XML data.to find localtime
local time = xml.text(xmldata, "xml://timezone/localtime")
print("DEBIG:", time)
return time
end
\stopluacode
\def\getCurrentTime{\ctxlua{context(thirddata.getcurrenttime())}}
\starttext
The current time is New York is \getCurrentTime.
\stoptext
Of course, if you are running a batch script to compile the file, you could as well get the data using any programming language of your choice, but where is the fun in that.