The disadvantage of the IFRAME failed to see the full page JS failure from loading CNZZ

Source: Internet
Author: User

One, iframe blocking onload

Window onload event to wait for all content on the page to load complete, including all the IFrame loading is completed before it will run, so it will give users a great "misunderstanding", in case the IFrame loaded too slow, it will make users feel the site is slow.

Solution: Use JavaScript to dynamically assign values to the IFRAME.

Second, link pool

For each Web server, the browser only has a few connections open. Older browsers, including IE 6/7 and Firefox 2, have only 2 connections per host. In the new browser, the number of connections increases the bird. Safari and Opera have increased to 4, with Chrome 1+, IE 8 and Firefox 3 to 6.

One might expect each IFRAME to have a separate connection pool, but this is not the case. In most browsers, the connection is shared by the main page and its iframe, which means that resources in the IFrame are likely to consume the available connections and block the load on the main page. This is good if the content in the IFrame is equally important, or more important than the main page. In general, however, the contents of the IFrame are less important to the page, and it is undesirable for the IFRAME to occupy the number of connections. One solution is to dynamically assign values to the IFRAME's SRC after a higher-priority resource download is complete.

Third, cost-performance

Creating an iframe consumes 10-100 times more performance than other DOM elements, including style or script

Reprint please indicate source: http://my.oschina.net/edire/

The disadvantage of the IFRAME failed to see the full page JS failure from loading CNZZ

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.