This project is archived and is in readonly mode.

#875 ✓invalid

Can't get html source from iframe

Reported by drejk | March 30th, 2010 @ 03:43 AM

Cant get the source code of iframe (on the same domain)

Expected behaviour: $("myFrameId").get('html');
But returns only empty value.


        insframe = new IFrame({
            src: "",

            styles: {
                width: 100,
                height: 100,
                border: '1px solid #ccc'
            events: {
                load: function(){
                    //EXPECTED BEHAVIOUR: shows empty string
                    //this correctly work in FF 3.6, IE 8, other browsers not tested

alert(document.getElementById(this.get('id')).contentWindow.document.body.innerHTML); alert(parent.document.getElementById(this.get('id')).contentWindow.document.body.innerHTML);




Comments and changes to this ticket

  • fakedarren

    fakedarren April 2nd, 2010 @ 11:30 AM

    • State changed from “new” to “invalid”

    This is expected behaviour. 'this' in this context is the iframe, not the iframe's window or document.

    You can shorten your code to "this.contentWindow.document.body.get('html')";

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket