add.header | R Documentation |
add.header
appends additional headers to the HTML reponse when
using WebResult
with any other command than
"raw"
.
This is useful for handling of cookies (see getCookies()
in the
sample common.R
script), cache-behavior, implementing
URL redirection etc.
add.header(txt)
txt |
character vector of header entires. The string may NOT
include any CR/LF characters, those will be automatically generated
when the final response is constructed. Elements of the vector should
represent lines. It is user's responsibility to ensure the entries are
valid according to the HTTP standard. Also note that you should never
add either |
Character vector of the resulting headers
Simon Urbanek
WebResult
## main.css.R: serve a static file (main.css) with cache control
run <- function(...) {
# last for at most an hour
add.header("Cache-Control: max-age=3600")
WebResult("file", "main.css", "text/css")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.