DEV Community

Discussion on: How to Load HTML, CSS, and JS Code into an iFrame

Collapse
 
johnaweiss profile image
johnaweiss • Edited

Hi Josh, i'm eager to use blobs! To use your barebone code, don't i need to put something in the page-load event, so the iframe gets rendered before the blob-code runs? I mean, couldja put a lil' meat on the bones? :) Thx!

Collapse
 
pulljosh profile image
Josh Pullen • Edited

If your <script> is placed at the bottom of the <body>, it should run after the iframe exists in the DOM, so you're all good. If you're placing the <script> inside the <head> then you would need to grab the iframe and set its source after the body loads.