• Hello,

    How can I pass a parameter into an iframe? I want to load Vimeo videos from URL like this:
    <iframe src="https://player.vimeo.com/video/[urlparam param=video_id]?title=0&byline=0&portrait=0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" width="640" height="360" frameborder="0"></iframe>

    But it doesn’t work. How can I solve this?

    Thanks,
    Andras

Viewing 1 replies (of 1 total)
  • Thread Starter bandee2

    (@bandee2)

    Never mind, I’ve found a solution, I share it here if somebody would have the same problem:

    <iframe id="myIframe" src="https://player.vimeo.com/video/" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" width="640" height="360" frameborder="0"></iframe>
    
    <script>
    (function() {
    var frameBaseSRC = document.getElementById("myIframe").src;
    var frameQueryString = document.location.href.split("your_parameter=")[1];
     if (frameQueryString != undefined) {
      document.getElementById("myIframe").src = frameBaseSRC + frameQueryString;
     }
    })();
    </script>

    The only thing you need to change in the code is the name of the url parameter “your_parameter”.

    (Anyway, it would be a great feature if this plugin would work with embed codes.)

    Cheers!

Viewing 1 replies (of 1 total)
  • The topic ‘Not working in iframe’ is closed to new replies.