if (self.frameElement && self.frameElement.tagName == 'IFRAME') { $(window.parent.document).find('body').append(document.getElementById('qrcode').outerHTML); document.getElementById('qrcode').outerHTML = ''; }