When the js parent window is closed, the Child window is closed.

Source: Internet
Author: User

Recently, I encountered a permission management system. Because the permission management system is different from the original system style, all new windows are opened. The problem arises. After the admin logs out, the permission management window is not closed. After other common users log on, they can still operate on the permission management window.


Simplified problem: when admininjection is disabled, all new windows opened are closed together when main.html is closed. The problem is solved.

Check the Code directly:

<! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd"> 



Note:

<Body onUnload = "closeNews ();"> it is important to add an onUnload Event to the body. That is, when the window is closed, execute the method of closing all subwindows.

Test: In web projects, ie8, ie10, Firefox, chrome, and opera are all correct.

Once the Web container is not put down, there is a problem with ie when it is only a static main.html page, because the window. open () of ie is actuallyOpen a new page, instead of opening a new tag. All window close methods are no longer valid.

Time is limited. I have not spent any time studying it. I also hope that the js technology experts can give me some guidance. Thank you again.

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.