Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

SSH series: (21) problems with expired Session and nesting login pages

2025-04-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

When frameset is used in the system, the current user's system login information expires; if you click the menu on the left, the login page is displayed on the right, and the correct thing is to return the entire page to the login page.

To solve this problem: you should use the js script in the jump to the login page to determine whether the current page is within the frame, that is, whether the window of the current page is a top-level window, if it is a child window; if you can refresh the address of the parent window directly, the entire page will automatically jump to the login page.

If (windowboxes = window.parent) {window.parent.location.reload (true);}

Maybe the one below is more appropriate.

/ / solve the problem of subframework nesting if (window.self! = window.top) {window.top.location.reload (true);}

Window.parent description: window.parent can get the parent window or parent frame of a frame. The parent of the top-level window refers to itself, and you can use this feature to determine whether the window is a top-level window.

Address: http://blog.csdn.net/zdwzzu2006/article/details/6047632

When applying a page with frameset or iframe, parent is the parent window, top is the top-level parent window (some windows contain several layers of frameset or iframe), self is the current window, and opener is the window that opens the current window with the open method.

Window.self

Function: is a reference to the current window itself. It is equivalent to the window property.

Syntax: window.self

Note: window, self and window.self are equivalent.

Window.top

Function: return to the top window, that is, the browser window.

Syntax: window.top

Note: if the window itself is the top-level window, the top property returns a reference to itself.

Window.parent

Function: return to the parent window.

Syntax: window.parent

Note: if the window itself is a top-level window, the parent property returns a reference to itself.

In a frame web page, the parent window is usually the top-level window, but if there is a frame in the frame, the parent window and the top-level window are not necessarily the same.

Determine whether the current window is in a frame:

Var b = window.topically created window.self

[xss_clean] ("whether the current window is in a frame:" + b)

You should think of the frame as a different area of the window, and the frame is a specific part of the browser window. A browser window can be divided into as many frames as you need, and a single frame can be divided into other frames, that is, the so-called nested frames.

Address: https://developer.mozilla.org/en-US/docs/Web/API/Location/reload

Location.reload ()

The Location.reload () method reloads the resource from the current URL. Its optional unique parameter is a Boolean, which, when it is true, causes the page to always be reloaded from the server. If it is false or not specified, the browser may reload the page from its cache.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report