通过点击不同的闪亮应用程序中的链接打开一个闪亮的应用程序?
答
要打开链接外,你可以插入:
tag("a", list(href = "http://www.myapps.com/otherapp", "Other App"))
在HTML(语言)的“A”标签用于表示一个链接一般来说和href
属性所在的路径插入。下面我扔在一起使用所有闪亮的应用程序库和帮助链接
ui <- bootstrapPage(
tag('ul',
lapply(read_html("http://shiny.rstudio.com/gallery/") %>%
xml_find_all('//a'), function(i){
li <- url_absolute(xml_attr(i, 'href'), xml_url(i))
data.frame(li = li,
txt = stri_trans_totitle(
trimws(gsub("\\-|\\.html"," ",basename(li)))),
stringsAsFactors = FALSE)
}) %>% rbind.pages() %>%
dplyr::filter(!duplicated(txt)) %>% apply(., 1, function(x){
tag("li",list(tag("a", list(href = x[[1]],x[[2]]))))
}))
)
server <- function(session, input, output){
}
shinyApp(ui, server)
任何链接到外部应用一个简单的例子,你可以使用:
ext.link <- function(label = NULL, link = NULL){
tag("a", list(href = link,
ifelse(!is.null(label), label, basename(link))))
}
将产生在您的应用程序的HTML:
> ext.link(label = "New app", link = "http://mypage.com/new_app")
<a href="http://mypage.com/new_app">New app</a>
是否指您的服务器/帐户或外部网站上托管的其他应用的链接? –