我正在为TinyMCE编写一个插件,并且在检测iframe中的点击事件时遇到问题.
从我的搜索中我得出了这个:
正在加载iframe:
<iframe src='resource/file.php?mode=tinymce' id='filecontainer'></iframe>
Run Code Online (Sandbox Code Playgroud)
iframe中的HTML:
<input type=button id=choose_pics value='Choose'>
Run Code Online (Sandbox Code Playgroud)
jQuery的:
//Detect click
$("#filecontainer").contents().find("#choose_pic").click(function(){
//do something
});
Run Code Online (Sandbox Code Playgroud)
我见过的其他帖子通常有不同域名的问题(这没有).但是,仍然没有发现事件.
可以这样做吗?
我正在尝试将我的Shiny应用程序重定向到另一个页面.我正在使用httr发送GET请求并查看用户是否已登录.如果不是,我想将其重定向到另一个链接.
我可以只使用R/Shiny做到这一点,还是需要一些额外的库?
样品:
library(httr)
library(shiny)
shinyServer(function(input, output) {
rv <- reactiveValues()
rv$mytoken = session$request$token
observeEvent(input$button1, {
rv$a <- GET("my.url:3405/authtoken",
add_headers(
.headers = c("token" = rv$mytoken)
))
if (rv$a$status_code == 200) {
} else {
# redirect magic
}
})
}
shinyUI(fluidPage(
actionButton(button1, "btn")
))
Run Code Online (Sandbox Code Playgroud)