1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Iframe loading and processing

Discussion in 'HTML & Website Design' started by Mulligan81, Oct 6, 2017.

  1. #1
    Having following code

    <iframe id="myframe" src="..."></iframe>

    <script>
    document.getElementById('myframe').onload = function() {
    alert('myframe is loaded');
    };
    </script>


    i wonder how does the browser processes an iframes? Does it load the iframe content in the separate thread? If so is it run synchronously with the main thread?
     
    Mulligan81, Oct 6, 2017 IP
  2. SoftLink

    SoftLink Active Member

    Messages:
    103
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Older browsers definitely use 1 thread. Most current browsers use 1 process.
    Chrome does additional tabs & iframes out of process.
     
    SoftLink, Oct 6, 2017 IP
  3. Mulligan81

    Mulligan81 Member

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #3
    So in the case of "current browsers" does it mean that when the browser hits <iframe> tag it starts a new thread to process & load iframe content while the main thread continues processing the main site code - that is it processes the JavaScript code lying below the iframe tag?
     
    Mulligan81, Oct 6, 2017 IP
  4. SoftLink

    SoftLink Active Member

    Messages:
    103
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Only in Chrome and what Chrome actually does is questionable.
    Most browsers will run 1 thread.
    For coding a site you should just expect the browser to run 1 thread total.
     
    SoftLink, Oct 6, 2017 IP
  5. Mulligan81

    Mulligan81 Member

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #5
    Ok so what is the processing sequence? That one main thread first finishes processing the main site code ended with </html> tag and then starts to load & process the iframe content?
     
    Mulligan81, Oct 6, 2017 IP
  6. SoftLink

    SoftLink Active Member

    Messages:
    103
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #6
    It depends on the browser and you'd have to really study browser internals to find out.
    I doubt that information is available.
     
    SoftLink, Oct 6, 2017 IP
  7. Mulligan81

    Mulligan81 Member

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #7
    Ok thx for help
     
    Mulligan81, Oct 6, 2017 IP
  8. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #8
    Try Mozilla Developer Network. If not on the page I linked, there are others aimed at Firefox developers, too.

    gary

    //edit: For practical purposes, loading an iframe is equivalent to loading an image or object. ~g
     
    Last edited: Oct 9, 2017
    kk5st, Oct 9, 2017 IP
    deathshadow likes this.
  9. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #9
    Which is part of why we were told with 4 Strict that in the next "real" HTML IFRAME and IMG would be deprecated in favor of OBJECT. This never materialized though as too few people embraced the improvements of Strict (even fewer grasped the concepts), and then the WhatWG came along and pissed on any real improvements inside <body> with their "HTML 5".
     
    deathshadow, Oct 9, 2017 IP
  10. Arun Kumar Soni

    Arun Kumar Soni Well-Known Member

    Messages:
    271
    Likes Received:
    16
    Best Answers:
    2
    Trophy Points:
    115
    #10
    Make sure search robots can access the content in your iFrame. You can do this easily by indexing the iFrame with robots.txt.
     
    Arun Kumar Soni, Oct 9, 2017 IP