iframe not loading videoRemove border from IFrameResizing an iframe based on contentHow to apply CSS to iframe?Invoking JavaScript code in an iframe from the parent pageHow to identify if a webpage is being loaded inside an iframe or directly into the browser window?jQuery/JavaScript: accessing contents of an iframeLoad iframe links into parent window?Embedded Youtube Video Will Not Play AutomaticallyYoutube video not working on my siteHtml video display - incorrect size?

Expand and Contract

What's the in-universe reasoning behind sorcerers needing material components?

Would Slavery Reparations be considered Bills of Attainder and hence Illegal?

What reasons are there for a Capitalist to oppose a 100% inheritance tax?

How can I deal with my CEO asking me to hire someone with a higher salary than me, a co-founder?

How do I deal with an unproductive colleague in a small company?

How would I stat a creature to be immune to everything but the Magic Missile spell? (just for fun)

What are some good books on Machine Learning and AI like Krugman, Wells and Graddy's "Essentials of Economics"

Short story with a alien planet, government officials must wear exploding medallions

Does the Idaho Potato Commission associate potato skins with healthy eating?

Why can't we play rap on piano?

How do I gain back my faith in my PhD degree?

Which is the best way to check return result?

iPad being using in wall mount battery swollen

Why is consensus so controversial in Britain?

Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?

Forming a German sentence with/without the verb at the end

Do scales need to be in alphabetical order?

Do UK voters know if their MP will be the Speaker of the House?

Unable to supress ligatures in headings which are set in Caps

Why would the Red Woman birth a shadow if she worshipped the Lord of the Light?

How badly should I try to prevent a user from XSSing themselves?

Could the museum Saturn V's be refitted for one more flight?

Why didn't Miles's spider sense work before?



iframe not loading video


Remove border from IFrameResizing an iframe based on contentHow to apply CSS to iframe?Invoking JavaScript code in an iframe from the parent pageHow to identify if a webpage is being loaded inside an iframe or directly into the browser window?jQuery/JavaScript: accessing contents of an iframeLoad iframe links into parent window?Embedded Youtube Video Will Not Play AutomaticallyYoutube video not working on my siteHtml video display - incorrect size?













-1















This is the code I have and it looks right to me. However it's not loading the linked video as it should.



var clickHandler3 = function()

var iframe = document.createElement("iframe"); 
iframe.setAttribute("src","https://www.youtube.com/watch?v=mXnJqYwebF8autoplay=1");
iframe.setAttribute("allow","autoplay"); 
iframe.style.width = "300px";
iframe.style.height = "250px";
document.body.appendChild(iframe);
;

window.addEventListener("load", setup);









share|improve this question



















  • 2





    does setup call clickHandler3?

    – Nils Kähler
    Mar 7 at 22:25











  • What does setup do?

    – Uzer
    Mar 7 at 22:27











  • I have no idea what setup does. I'm shooting in the dark with this project. This is a knock knock joke HTML webpage that ends with a button that says "Youtube it!" and opens a video related to the knock knock joke.

    – mwiggy
    Mar 7 at 22:29






  • 1





    you have to upload the full code and explain what you'd try so far. If you are shooting in the dark, you cant expect the community to help you.

    – Alex Angelico
    Mar 7 at 23:01











  • What exactly does not work with the given code? Is there any error message?

    – Nico Haase
    Mar 8 at 8:50















-1















This is the code I have and it looks right to me. However it's not loading the linked video as it should.



var clickHandler3 = function()

var iframe = document.createElement("iframe"); 
iframe.setAttribute("src","https://www.youtube.com/watch?v=mXnJqYwebF8autoplay=1");
iframe.setAttribute("allow","autoplay"); 
iframe.style.width = "300px";
iframe.style.height = "250px";
document.body.appendChild(iframe);
;

window.addEventListener("load", setup);









share|improve this question



















  • 2





    does setup call clickHandler3?

    – Nils Kähler
    Mar 7 at 22:25











  • What does setup do?

    – Uzer
    Mar 7 at 22:27











  • I have no idea what setup does. I'm shooting in the dark with this project. This is a knock knock joke HTML webpage that ends with a button that says "Youtube it!" and opens a video related to the knock knock joke.

    – mwiggy
    Mar 7 at 22:29






  • 1





    you have to upload the full code and explain what you'd try so far. If you are shooting in the dark, you cant expect the community to help you.

    – Alex Angelico
    Mar 7 at 23:01











  • What exactly does not work with the given code? Is there any error message?

    – Nico Haase
    Mar 8 at 8:50













-1












-1








-1








This is the code I have and it looks right to me. However it's not loading the linked video as it should.



var clickHandler3 = function()

var iframe = document.createElement("iframe"); 
iframe.setAttribute("src","https://www.youtube.com/watch?v=mXnJqYwebF8autoplay=1");
iframe.setAttribute("allow","autoplay"); 
iframe.style.width = "300px";
iframe.style.height = "250px";
document.body.appendChild(iframe);
;

window.addEventListener("load", setup);









share|improve this question
















This is the code I have and it looks right to me. However it's not loading the linked video as it should.



var clickHandler3 = function()

var iframe = document.createElement("iframe"); 
iframe.setAttribute("src","https://www.youtube.com/watch?v=mXnJqYwebF8autoplay=1");
iframe.setAttribute("allow","autoplay"); 
iframe.style.width = "300px";
iframe.style.height = "250px";
document.body.appendChild(iframe);
;

window.addEventListener("load", setup);






javascript html iframe






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 22:50









Heretic Monkey

6,55863672




6,55863672










asked Mar 7 at 22:21









mwiggymwiggy

1




1







  • 2





    does setup call clickHandler3?

    – Nils Kähler
    Mar 7 at 22:25











  • What does setup do?

    – Uzer
    Mar 7 at 22:27











  • I have no idea what setup does. I'm shooting in the dark with this project. This is a knock knock joke HTML webpage that ends with a button that says "Youtube it!" and opens a video related to the knock knock joke.

    – mwiggy
    Mar 7 at 22:29






  • 1





    you have to upload the full code and explain what you'd try so far. If you are shooting in the dark, you cant expect the community to help you.

    – Alex Angelico
    Mar 7 at 23:01











  • What exactly does not work with the given code? Is there any error message?

    – Nico Haase
    Mar 8 at 8:50












  • 2





    does setup call clickHandler3?

    – Nils Kähler
    Mar 7 at 22:25











  • What does setup do?

    – Uzer
    Mar 7 at 22:27











  • I have no idea what setup does. I'm shooting in the dark with this project. This is a knock knock joke HTML webpage that ends with a button that says "Youtube it!" and opens a video related to the knock knock joke.

    – mwiggy
    Mar 7 at 22:29






  • 1





    you have to upload the full code and explain what you'd try so far. If you are shooting in the dark, you cant expect the community to help you.

    – Alex Angelico
    Mar 7 at 23:01











  • What exactly does not work with the given code? Is there any error message?

    – Nico Haase
    Mar 8 at 8:50







2




2





does setup call clickHandler3?

– Nils Kähler
Mar 7 at 22:25





does setup call clickHandler3?

– Nils Kähler
Mar 7 at 22:25













What does setup do?

– Uzer
Mar 7 at 22:27





What does setup do?

– Uzer
Mar 7 at 22:27













I have no idea what setup does. I'm shooting in the dark with this project. This is a knock knock joke HTML webpage that ends with a button that says "Youtube it!" and opens a video related to the knock knock joke.

– mwiggy
Mar 7 at 22:29





I have no idea what setup does. I'm shooting in the dark with this project. This is a knock knock joke HTML webpage that ends with a button that says "Youtube it!" and opens a video related to the knock knock joke.

– mwiggy
Mar 7 at 22:29




1




1





you have to upload the full code and explain what you'd try so far. If you are shooting in the dark, you cant expect the community to help you.

– Alex Angelico
Mar 7 at 23:01





you have to upload the full code and explain what you'd try so far. If you are shooting in the dark, you cant expect the community to help you.

– Alex Angelico
Mar 7 at 23:01













What exactly does not work with the given code? Is there any error message?

– Nico Haase
Mar 8 at 8:50





What exactly does not work with the given code? Is there any error message?

– Nico Haase
Mar 8 at 8:50












2 Answers
2






active

oldest

votes


















0














In the comments you write




I have no idea what setup does. I'm shooting in the dark with this project. This is a knock knock joke HTML webpage that ends with a button that says "Youtube it!" and opens a video related to the knock knock joke.




I suggest a quick solution for this problem by adding a button that calls clickHandler3() with onclick="clickHandler3()"



I have changed the iframe to the embed data that is present on youtube for simplicity.



Does this work for you?






function clickHandler3() 
document.body.innerHTML = '<iframe width="300" height="250" src="https://www.youtube.com/embed/mXnJqYwebF8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
;

<body>
<button onclick="clickHandler3()">
click this
</button>
</body>








share|improve this answer
































    0














    var clickHandler3 =function()



    var iFrameElem = document.createElement("iframe");

    iFrameElem.setAttribute('height', '315');

    iFrameElem.setAttribute('width', '560');

    iFrameElem.setAttribute('src', 'https://www.youtube.com/embed/mXnJqYwebF8autoplay=1&mute=1');

    iFrameElem.classList.add('player');

    bodyElem = document.querySelector('body');

    bodyElem.innerHTML = '';

    bodyElem.classList.add('center');

    bodyElem.appendChild(iFrameElem);

    ;

    window.addEventListener("load", setup);





    share|improve this answer

























    • Does this work for you? Where is bodyElem defined? does your method setup() call clickHandler3()?

      – Nils Kähler
      Mar 8 at 8:51











    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55053738%2fiframe-not-loading-video%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    In the comments you write




    I have no idea what setup does. I'm shooting in the dark with this project. This is a knock knock joke HTML webpage that ends with a button that says "Youtube it!" and opens a video related to the knock knock joke.




    I suggest a quick solution for this problem by adding a button that calls clickHandler3() with onclick="clickHandler3()"



    I have changed the iframe to the embed data that is present on youtube for simplicity.



    Does this work for you?






    function clickHandler3() 
    document.body.innerHTML = '<iframe width="300" height="250" src="https://www.youtube.com/embed/mXnJqYwebF8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
    ;

    <body>
    <button onclick="clickHandler3()">
    click this
    </button>
    </body>








    share|improve this answer





























      0














      In the comments you write




      I have no idea what setup does. I'm shooting in the dark with this project. This is a knock knock joke HTML webpage that ends with a button that says "Youtube it!" and opens a video related to the knock knock joke.




      I suggest a quick solution for this problem by adding a button that calls clickHandler3() with onclick="clickHandler3()"



      I have changed the iframe to the embed data that is present on youtube for simplicity.



      Does this work for you?






      function clickHandler3() 
      document.body.innerHTML = '<iframe width="300" height="250" src="https://www.youtube.com/embed/mXnJqYwebF8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
      ;

      <body>
      <button onclick="clickHandler3()">
      click this
      </button>
      </body>








      share|improve this answer



























        0












        0








        0







        In the comments you write




        I have no idea what setup does. I'm shooting in the dark with this project. This is a knock knock joke HTML webpage that ends with a button that says "Youtube it!" and opens a video related to the knock knock joke.




        I suggest a quick solution for this problem by adding a button that calls clickHandler3() with onclick="clickHandler3()"



        I have changed the iframe to the embed data that is present on youtube for simplicity.



        Does this work for you?






        function clickHandler3() 
        document.body.innerHTML = '<iframe width="300" height="250" src="https://www.youtube.com/embed/mXnJqYwebF8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
        ;

        <body>
        <button onclick="clickHandler3()">
        click this
        </button>
        </body>








        share|improve this answer















        In the comments you write




        I have no idea what setup does. I'm shooting in the dark with this project. This is a knock knock joke HTML webpage that ends with a button that says "Youtube it!" and opens a video related to the knock knock joke.




        I suggest a quick solution for this problem by adding a button that calls clickHandler3() with onclick="clickHandler3()"



        I have changed the iframe to the embed data that is present on youtube for simplicity.



        Does this work for you?






        function clickHandler3() 
        document.body.innerHTML = '<iframe width="300" height="250" src="https://www.youtube.com/embed/mXnJqYwebF8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
        ;

        <body>
        <button onclick="clickHandler3()">
        click this
        </button>
        </body>








        function clickHandler3() 
        document.body.innerHTML = '<iframe width="300" height="250" src="https://www.youtube.com/embed/mXnJqYwebF8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
        ;

        <body>
        <button onclick="clickHandler3()">
        click this
        </button>
        </body>





        function clickHandler3() 
        document.body.innerHTML = '<iframe width="300" height="250" src="https://www.youtube.com/embed/mXnJqYwebF8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
        ;

        <body>
        <button onclick="clickHandler3()">
        click this
        </button>
        </body>






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 8 at 8:52

























        answered Mar 7 at 22:46









        Nils KählerNils Kähler

        606516




        606516























            0














            var clickHandler3 =function()



            var iFrameElem = document.createElement("iframe");

            iFrameElem.setAttribute('height', '315');

            iFrameElem.setAttribute('width', '560');

            iFrameElem.setAttribute('src', 'https://www.youtube.com/embed/mXnJqYwebF8autoplay=1&mute=1');

            iFrameElem.classList.add('player');

            bodyElem = document.querySelector('body');

            bodyElem.innerHTML = '';

            bodyElem.classList.add('center');

            bodyElem.appendChild(iFrameElem);

            ;

            window.addEventListener("load", setup);





            share|improve this answer

























            • Does this work for you? Where is bodyElem defined? does your method setup() call clickHandler3()?

              – Nils Kähler
              Mar 8 at 8:51















            0














            var clickHandler3 =function()



            var iFrameElem = document.createElement("iframe");

            iFrameElem.setAttribute('height', '315');

            iFrameElem.setAttribute('width', '560');

            iFrameElem.setAttribute('src', 'https://www.youtube.com/embed/mXnJqYwebF8autoplay=1&mute=1');

            iFrameElem.classList.add('player');

            bodyElem = document.querySelector('body');

            bodyElem.innerHTML = '';

            bodyElem.classList.add('center');

            bodyElem.appendChild(iFrameElem);

            ;

            window.addEventListener("load", setup);





            share|improve this answer

























            • Does this work for you? Where is bodyElem defined? does your method setup() call clickHandler3()?

              – Nils Kähler
              Mar 8 at 8:51













            0












            0








            0







            var clickHandler3 =function()



            var iFrameElem = document.createElement("iframe");

            iFrameElem.setAttribute('height', '315');

            iFrameElem.setAttribute('width', '560');

            iFrameElem.setAttribute('src', 'https://www.youtube.com/embed/mXnJqYwebF8autoplay=1&mute=1');

            iFrameElem.classList.add('player');

            bodyElem = document.querySelector('body');

            bodyElem.innerHTML = '';

            bodyElem.classList.add('center');

            bodyElem.appendChild(iFrameElem);

            ;

            window.addEventListener("load", setup);





            share|improve this answer















            var clickHandler3 =function()



            var iFrameElem = document.createElement("iframe");

            iFrameElem.setAttribute('height', '315');

            iFrameElem.setAttribute('width', '560');

            iFrameElem.setAttribute('src', 'https://www.youtube.com/embed/mXnJqYwebF8autoplay=1&mute=1');

            iFrameElem.classList.add('player');

            bodyElem = document.querySelector('body');

            bodyElem.innerHTML = '';

            bodyElem.classList.add('center');

            bodyElem.appendChild(iFrameElem);

            ;

            window.addEventListener("load", setup);






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 8 at 9:03









            Davit

            4,17731237




            4,17731237










            answered Mar 7 at 23:05









            mwiggymwiggy

            1




            1












            • Does this work for you? Where is bodyElem defined? does your method setup() call clickHandler3()?

              – Nils Kähler
              Mar 8 at 8:51

















            • Does this work for you? Where is bodyElem defined? does your method setup() call clickHandler3()?

              – Nils Kähler
              Mar 8 at 8:51
















            Does this work for you? Where is bodyElem defined? does your method setup() call clickHandler3()?

            – Nils Kähler
            Mar 8 at 8:51





            Does this work for you? Where is bodyElem defined? does your method setup() call clickHandler3()?

            – Nils Kähler
            Mar 8 at 8:51

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55053738%2fiframe-not-loading-video%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

            Алба-Юлія

            Захаров Федір Захарович