I can use a() to add a hyperlink in to an external site from my Shiny app,
我可以使用a()从我的Shiny应用程序添加到外部站点的超链接,
a("google",href="http://www.google.com")
but how do I make a link to open a pdf (or similar) file? Seems like it should be simple, but I can't find any examples. My question is similar to this one:
但是如何创建一个打开pdf(或类似)文件的链接?似乎它应该很简单,但我找不到任何例子。我的问题类似于这个问题:
Add link to R Shiny Application so link opens in a new browser tab
添加指向R Shiny Application的链接,以便在新的浏览器选项卡中打开链接
but I don't know how to structure the href part- where do I put the file to be opened and how do I specify its location? I've tried simple things like http:///C:/Folder/file.pdf or file:///C:/Folder/file.pdf but the file is either not found or wont open.
但我不知道如何构建href部分 - 我在哪里打开文件,如何指定其位置?我尝试过像http:/// C:/Folder/file.pdf或file:/// C:/Folder/file.pdf这样的简单文件,但文件未找到或无法打开。
I am new to shiny and have no html experience, so any suggestions greatly appreciated.
我是新手,没有html的经验,所以任何建议都非常感谢。
Thanks
谢谢
1 个解决方案
#1
12
Put the pdf file inside the "www" directory (it has to be a subdirectory inside the directory where there are ui.r
and server.r
)
将pdf文件放在“www”目录中(它必须是目录中有ui.r和server.r的子目录)
then you can run your shiny with:
然后你可以运行你的闪亮:
a("click on me",target="_blank",href="myfile.pdf")
#1
12
Put the pdf file inside the "www" directory (it has to be a subdirectory inside the directory where there are ui.r
and server.r
)
将pdf文件放在“www”目录中(它必须是目录中有ui.r和server.r的子目录)
then you can run your shiny with:
然后你可以运行你的闪亮:
a("click on me",target="_blank",href="myfile.pdf")