Javascript: print iframe cross browser

// define
$.fn.printIframe = function(){
    var $this = $(this)[0];
    if(!$this.contentWindow.document.execCommand('print', false, null)) { // working, except Firefox
        $this.contentWindow.print(); // working, except IE
    }
}

// usage
$('#iframe').printIframe();