Simple Editable IFrame

For jquery 1.9+ version please make sure you include jquery.mb.browser.min.js right after the place where jquery is included. This is adding back removed $.browser property.




        $(document).ready(function () {

            $(".simpleIFrame").each(function (i, iframe) {
                //BEGIN - Make Iframe editable                
                var doc = iframe.contentDocument || iframe.contentWindow.document;

                doc.body.innerHTML = iframe.textContent || iframe.innerHTML;

                if (doc.body.contentEditable) {
                    doc.body.contentEditable = true;
                }
                //END - Make Iframe editable
            });

            //BEGIN - Attach resize functionality to IFrame
            if ($.browser.webkit) {
                //make sure if it's a webkit browser you don't include the td element into the wysiwygResize selector option.
                $(".simpleIFrame").wysiwygResize({
                    selector: "div, h1, h3"
                }).webkitimageresize().webkittableresize().webkittdresize();
            }
            else {
                $(".simpleIFrame").wysiwygResize({
                    selector: "div, td, h1, h3"
                });
            }
            //END - Attach resize functionality to IFrame
        });