javascript - 如何将小程序插入闪亮的 R
问题描述
我想包括使用闪亮的可视化分子结构的小程序(我是 html 和闪亮的初学者),我有两个问题。
首先,当我包含 html 文件时,它会生成错误“连接到服务器时出错:https://chemapps.stolaf ...”
代码:
ui = shinyUI(fluidPage(
includeHTML("applet.html"),
mainPanel()
))
其中 applet.html 是:
<html>
<body>
Applet
<script type="text/javascript"
src="http://chemapps.stolaf.edu/jmol/jmol.php?model=acetone&inline">
</script>
</body>
</html>
但是,如果我在运行代码后按“在浏览器中打开”,它工作正常。它可以在没有在浏览器中打开的情况下闪亮地工作吗?
其次,更重要的是我需要从服务器加载小程序:
# ----- ui.R -----
ui = shinyUI(fluidPage(
mainPanel(
htmlOutput("inc")
)
))
# ----- server.R -----
server = shinyServer(function(input, output) {
getPage<-function() {
return(includeHTML("applet.html"))
}
output$inc<-renderUI({getPage()})
})
但是,小程序不起作用,尽管似乎也正确加载了 html 文件,因为出现了“小程序”文本。
我将不胜感激任何帮助
解决方案
推荐阅读
- javascript - 我的 html 表单操作在浏览器中显示 javascript 代码
- javascript - 什么是 JS 等价于 Ruby :tr 方法?
- node.js - 错误:找不到模块“./options/SchemaTypeOptions”
- d3.js - 从工具提示还原更改
- python - Python tkinter 按钮命令
- firebase - 为什么有“firebase”时会有“@firebase/app”npm 包?
- sql - 如何使用 Haskell 中的 Beam 库编写返回嵌套列表的查询?
- c# - 如何对通过启动多个实例来旋转线程的内置 c# 程序 (program.exe) 进行压力测试
- reactjs - 如何更改 formcontrollabel 的默认排版类 - material-ui | 反应?
- python-2.7 - 为什么可执行文件会停止在 python 中使用 popen