{"id":404,"date":"2012-03-24T01:11:44","date_gmt":"2012-03-24T01:11:44","guid":{"rendered":"https:\/\/theextremewebdesigns.com\/blog\/?p=404"},"modified":"2012-03-24T01:11:44","modified_gmt":"2012-03-24T01:11:44","slug":"remove-iframe-html-using-javascript","status":"publish","type":"post","link":"https:\/\/theextremewebdesigns.com\/blog\/remove-iframe-html-using-javascript\/","title":{"rendered":"Remove Iframe html using Javascript"},"content":{"rendered":"<p>Let&#8221;s say that you are showing an iframe in a page. If you notice, you will see that the contents of the page will also be shown in the iframe by default. Using this simple 1 line trick, you can <strong>remove iframe html using javascript<\/strong>.<!--more--><\/p>\n<h2>How To\u00a0Remove Iframe html using Javascript Example<\/h2>\n<p>Let&#8217;s assume that we have an IFrame with ID &#8220;myframe&#8221;. We can use the .setAttribute() method to completely remove the html contents from the Iframe.<\/p>\n<h3>Example:\u00a0Remove Iframe html using Javascript<\/h3>\n<pre class=\"lang:xhtml decode:true\">\/\/HTML:\n\n&lt;iframe id=\"myframe\" src=\"http:\/\/www.google.com\"&gt;&lt;\/iframe&gt;\n\n\/\/Javascript:\n\ndocument.getElementById( 'myframe' ).setAttribute( 'src', '' );<\/pre>\n<p>When you use the above code in your own web page and run it, you will see the contents of the iframe cease to exist. Easy, eh?<\/p>\n<h5>Your Turn!<\/h5>\n<p>Do you know of any other ways of using <em><strong>JavaScript to remove iframe html<\/strong><\/em>? Feel free to share by commenting below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8221;s say that you are showing an iframe in a page. If you notice, you will see that the contents of the page will also be shown in the iframe by default. Using this simple 1 line trick, you can remove iframe html using javascript.<\/p>\n","protected":false},"author":1,"featured_media":352,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[17,13],"tags":[60,35],"class_list":["post-404","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript-tips-and-tricks","category-tips-and-tricks","tag-javascript-2","tag-javascript-tips"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paBnQX-6w","jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/comments?post=404"}],"version-history":[{"count":0,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/404\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/media?parent=404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/categories?post=404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/tags?post=404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}