The use of iFrame

Source: Internet
Author: User

(Author: Glen, Senior Engineer of rebate network, once working in EA and other companies)

Recently, I have worked on a project-bucket favorites. Simply put, you can add your favorite images to the bucket page, which uses a lot of iframe, which is summarized as follows:

1. Overlay as a pop-up layer

If you have used the Black Mask to cover the entire page, and the user uses IE6, it is more likely that the page contains the select element, then there is a headache (the principle will not be described here ). We will find that the pop-up DIV cannot cover the select, and our iframe is playing. The logic is as follows:

  • Put iframe at the same level as the pop-up div
  • Make sure that the z-index of iframe is smaller than the z-index of the bullet layer div.
  • Added window resize and scroll events to ensure that iframe can cover the entire page.

Some code

Var iframe = U. isie6 ()? '<Iframe style = "position: absolute; left: 0; top: 0; z-index: 2000000; filter: Alpha (opacity = 0); width: 100%; height: '+ ds. height + '"frameborder =" 0 "> </iframe>':''; $ container. append (iframe ). appendTo ($ body );
2. Cross-origin write cookie

There are two domain names: a.com and B .com. Under some conditions, some functions of B will appear on page. Sometimes you need to perform some operations on B .com domain cookies during page a to facilitate the next access. You only need to add an iframe (dynamic or fixed) to page a. the src attribute points to a proxy page of page B and performs cookie operations on this page.

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.