Let's say I dynamically create an iframe node by using js, then set the src attribute (1) and finally append the node to the DOM (2).
When is the src content requested by the browser? After (1)? After (2)? Or is it unpredictable? Does it depend on the browser?
When an
iframe
element is first inserted into a document, the user agent must create a nested browsing context, and then process theiframe
attributes for the first time.
var f = document.createElement('iframe');
f.src = '/?';
The resource is never fetched (I've only shown the lowest and highest tested browser version):
So, it the request is only sent once the frame is appended to the document.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With