1

I have developed a website in R using shiny. All the code and data is on a server ran by a third party.

On our institution website we have a full page embed of this address to provide a nice permanent URL using this HTML file ...

<html> 
<head>
    <style type="text/css">
        body
        {
            margin:   0;
            overflow: hidden;
        }

        #iframe1
        {
            height:   100%;
            left:     0px;
            position: absolute;
            top:      0px;
            width:    100%;
        }
    </style>
</head>

<body>
    <iframe id="iframe1" src="http://www.thirdpartyurl.com" frameborder="0"></iframe>
</body>
</html>

I have received some requests to add direct links to different parts of the navpage layout of the shiny app, which I have managed to do using ?nav, e.g. http://www.thirdpartyurl.com/?nav=Section A However, I do not know how to adapt the above HTML code (or some other way) so that we can provide a direct link (i.e. embed) for users to the relative section when they use the http://www.niceurl.com/?nav=Section A URL?

guyabel
  • 8,014
  • 6
  • 57
  • 86

1 Answers1

1

Use this for the iframe (only if you can/are using php files)

<iframe id="iframe1" src="http://www.thirdpartyurl.com/<?php echo !empty($_GET['nav']) ? '?nav=' . $_GET['nav'] : '' ?>" frameborder="0"></iframe>

If that doesn't work see this question for a javascript version to get the get attributes.

Community
  • 1
  • 1
Thaillie
  • 1,362
  • 3
  • 17
  • 31
  • Thanks @Thaillie. php does not seem to be an option. I have tried some javascript version... https://jsfiddle.net/qkfytgLe/1/ but it does not work either. Any ideas? I am clueless when it comes to javascript. – guyabel Oct 23 '15 at 14:06