h.l*_*l.m 7 internet-explorer google-chrome r shiny
我正在尝试使用在Internet Explorer和Google Chrome中使用Shiny工作时使用plotGoogleMaps,并且想知道我需要做些什么来修复它.
我正在使用的代码使用了另一个问题的答案
当Chrome是浏览器时,代码可以工作,但当IE是浏览器时,代码不起作用.
要在这里再次重复代码,它是:
library(plotGoogleMaps)
library(shiny)
runApp(list(
ui = pageWithSidebar(
headerPanel('Map'),
sidebarPanel(""),
mainPanel(uiOutput('mymap'))
),
server = function(input, output){
output$mymap <- renderUI({
data(meuse)
coordinates(meuse) = ~x+y
proj4string(meuse) <- CRS("+init=epsg:28992")
m <- plotGoogleMaps(meuse, filename = 'myMap1.html', openMap = F)
tags$iframe(
srcdoc = paste(readLines('myMap1.html'), collapse = '\n'),
width = "100%",
height = "600px"
)
})
}
))
Run Code Online (Sandbox Code Playgroud)
鉴于该文件已创建,我认为这可能是一个加载问题.
一如往常,任何帮助将不胜感激
你的问题不是R、shiny或plotGoogleMaps,而是IE对html5标准的支持。IE 对 srcdoc 的支持不好,请从此链接阅读。您可以使用polyfill来支持IE,但我认为没有必要,因为您已经在plotGoogleMaps步骤中创建了必要的html文件。
尝试以下代码。我没有提供 iframe srcdoc,而是使用src属性。此外,谷歌地图 html 是在 www 目录中创建的,以便闪亮的用户能够看到它。我让它在 IE 11 中工作。我认为它应该在 IE10 中工作。
我更改了对正常闪亮应用程序解决方案的答案,因为单文件应用程序似乎也存在问题。这是shinyapps的链接。另请参阅此处的Modern.ie 屏幕截图和所有IE 屏幕截图。
ui.R
library(plotGoogleMaps)
library(shiny)
shinyUI(fluidPage(
pageWithSidebar(
headerPanel('Map'),
sidebarPanel(""),
mainPanel(uiOutput('mymap'))
)
))
Run Code Online (Sandbox Code Playgroud)
服务器R
library(plotGoogleMaps)
library(shiny)
shinyServer(function(input, output) {
if (!file.exists("www"))
{
dir.create("www")
}
output$mymap <- renderUI({
data(meuse)
coordinates(meuse) = ~x+y
proj4string(meuse) <- CRS("+init=epsg:28992")
m <- plotGoogleMaps(meuse, filename = 'www/myMap1.html', openMap = F)
tags$iframe(
src = 'myMap1.html',
width = "100%",
height = "600px"
)
})
})
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
723 次 |
最近记录: |