【问题标题】:R Shiny iframe no longer displaying .pdf source after update?R Shiny iframe 更新后不再显示 .pdf 源代码?
【发布时间】:2014-11-08 11:24:54
【问题描述】:

我最近更新了我的包,我闪亮的应用程序有一个损坏的 iframe,用于显示来自网络的 pdf。

ui.R

library(shiny)

shinyUI(bootstrapPage(

      headerPanel("PDF VIEWER"),

      mainPanel(
        tags$iframe(style="height:600px; width:100%", src="http://radhome.gsfc.nasa.gov/radhome/papers/GOMAC05_LaBel.pdf"))
      )
  )

我已经在多台机器上检查过这个,它之前工作的事实让我相信 iframe 标记的行为很奇怪?

感谢任何帮助。

闪亮的 0.10.1

【问题讨论】:

    标签: r pdf iframe shiny


    【解决方案1】:

    您的推荐网站在标头中发送“x-frame-options sameorigin”,这基本上告诉任何浏览器不允许其内容显示在 iframe 中:

    library("RCurl")
    h = basicHeaderGatherer()
    appURL <- "http://radhome.gsfc.nasa.gov/radhome/papers/GOMAC05_LaBel.pdf"
    out <- getURL(appURL, headerfunction = h$update)
    appHeader <- h$value()
    > appHeader[["X-Frame-Options"]]
    [1] "SAMEORIGIN"
    

    【讨论】:

    • 感谢您对此进行调查。我将在没有 iframe 的情况下继续进行,但仍然对它之前为何起作用感到困惑。
    • 在他们没有发送同源头或者你使用旧浏览器之前。
    • 谢谢,我想投票,但我还没有代表。
    • 这是个好问题。您可以使用 nginx 之类的反向代理并发送更改后的标头 nginx.org/r/proxy_hide_header
    猜你喜欢
    • 2013-01-14
    • 1970-01-01
    • 1970-01-01
    • 2018-11-29
    • 1970-01-01
    • 2014-05-23
    • 2013-12-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多