Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

location.href in url(...) #226

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MikeBadescu
Copy link

Arrows do not work in WebKit (iPad, Safari) due to treatment of url(...) in WebKit. For this issue (and possible fixes), please see https://stackoverflow.com/a/29984481

I made one small change (added location.href) and now it seems to behave as expected.

Here is the sample Shiny app I used for testing. I have deployed it at https://numeract.shinyapps.io/test/ (it includes the suggested change).

require(shiny)
require(networkD3)

shiny::shinyApp(
    ui = bootstrapPage(
        networkD3::forceNetworkOutput(outputId = 'plot3')
    ),
    server = function(input, output) {
        
        data(MisLinks)
        data(MisNodes)
        
        output$plot3 <- networkD3::renderForceNetwork({
            forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
                         Target = "target", Value = "value", NodeID = "name",
                             Group = "group", opacity = 1, arrows = TRUE)
            
        })
    }
)

@cjyetman
Copy link
Collaborator

cjyetman commented Dec 4, 2017

I'm not opposed to this change, but the arrows work for me locally on macOS/Safari and don't when I publish it to shinyapps.io. Out of curiosity, does this have to do something with being in an iframe or something like that once it's published to shinyapps.io?

@MikeBadescu
Copy link
Author

I am not JS expert, but based on the stackoverflow answer I expect it has something to do with the <base href=" ... "> declaration (see page source), which might be specific to shinyapps.io. I do not know yet if this is relevant to Shiny Server itself.

@cjyetman
Copy link
Collaborator

cjyetman commented Dec 4, 2017

that makes sense, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants