File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes escaping an iframe Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "escaping an iframe" Watch "escaping an iframe" New topic

escaping an iframe

John Kim

Joined: Jun 16, 2003
Posts: 6
i have a page on my website where there's a parent central view page (jsp) which contains within an iframe another jsp page. i set a timeout on tomcat so that after the user's been inactive for a certain period of time he will be led to the login page when he tries to access the webpage again. the problem is, if a user clicks on a link or a button located in the jsp page within the iframe, the login page pops up inside the iframe, instead of encompassing the whole web browser window. i'd like to rectify this matter so that the latter will occur, but i cant seem to find a way to do it. i would like to do it on the servlet side if possible, since thats where i check if the session is valid and lead the user to the login page if the session is determined to be invalid. any help would be appreciated. thanks in advance.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

There's nothing you can do on the server side to change which window the response will be delivered to. It will be sent to the window that the request was submitted to,
What you'll need to do is to put client-side logic (in other words, Javascript) on the login page to detect whether it is loading into the top window or not, and to redirect to the top window when appropriate.
The HTML/Javascript would be a better forum for this topic.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: escaping an iframe
It's not a secret anymore!