0

Actually what i want,when submit the from that request go to this http://api.brightcove.com/services/post , i set target element of form to iframe.Then response is go to iframe correctly its ok.Problem is ,I want to get body content of iframe using javascript function but it is not working.This is my source

<html>
    <head>
        <script>

            function getIframe(){
                var iframe = document.getElementById('postFrame');
                var bodyC = iframe.contentDocument.body.innerHTML;
                alert(bodyC);
            }
        </script>
    </head >
    <body  >

        <form  action="http://api.brightcove.com/services/post" method="post" target='postFrame'>
            <input type="hidden" name='JSON' value="test"/>
        <button   type="submit" >Submit</button>
            <button  onclick="getIframe()" type="button">Check Iframe Result</button>                                 
        </form>

        <iframe id="postFrame" name="postFrame" style="width:100%;border:none" ></iframe>

    </body>
</html>
Charles
  • 50,943
  • 13
  • 104
  • 142
Tharanga
  • 377
  • 3
  • 8
  • 18
  • http://stackoverflow.com/questions/926916/how-to-get-the-bodys-content-of-an-iframe-in-javascript – user887675 Jun 06 '14 at 13:29
  • This specific answer may be what you are looking for: http://stackoverflow.com/questions/926916/how-to-get-the-bodys-content-of-an-iframe-in-javascript#answer-11107977 – Nivas Jun 06 '14 at 13:33
  • Actually i want upload video to Brightcove Video Cloud Service.I use their api.This is the source http://files.brightcove.com/create_video_multipletags.txt ,its works fine.After upload the video response is go to iframe.Its is json encoded.That response include video id which is uploaded before.I want that video ID – Tharanga Jun 06 '14 at 14:18
  • I changed getIframe function.And i got exception.'Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://localhost:81" from accessing a cross-origin frame.' – Tharanga Jun 07 '14 at 04:10

0 Answers0