new window popup

Reply

Join Date: Jan 2007
Posts: 6
Reputation: sandeep0708 is an unknown quantity at this point 
Solved Threads: 0
sandeep0708 sandeep0708 is offline Offline
Newbie Poster

new window popup

 
0
  #1
Jan 12th, 2007
Hi all,,

the problem is that i have a link in jsp on which i have to open a new jsp page and at that time i want the parent window to be closed ...without any alert to be displayed...
plzz help
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: new window popup

 
0
  #2
Jan 12th, 2007
the only way you could do that would be if your first window is opened by javascript (or maybe by named target).

otherwise, it would be an irritation risk if sites could close the browser.

if you want the parent window to close when a new page opens, why not just open the new page in the same window?? O_o
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: new window popup

 
0
  #3
Jan 12th, 2007
...perhaps that's not true.

in Opera:

HTML and CSS Syntax (Toggle Plain Text)
  1. <html>
  2. <head></head>
  3. <body>
  4. <script type="text/javascript">
  5. window.close();
  6. var newWindow = window.open('/home/matt/test3.html');
  7. </script>
  8. </body>
  9. </html>

works whether the window that processes that code was opened via a javascript process or not..

...interesting info.
Last edited by MattEvans; Jan 12th, 2007 at 3:00 pm.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: new window popup

 
0
  #4
Jan 12th, 2007
by the way. you will probably get an alert or 2 if that kind of thing is done on a browser that's alert-ridden, like IE7.

FOLLOWUP:
Even on an oldish version of Firefox (1.0.2), the correct behaviour is adhered to; the correct behaviour being that only script-generated windows can close themselves or be closed. Proofing is as follows:

File #1 (test1.html)
HTML and CSS Syntax (Toggle Plain Text)
  1. <html>
  2. <head></head>
  3. <body>
  4. <script type="text/javascript">
  5. alert("Opening test2 in a new window");
  6. var newWindow = window.open('/home/matt/test2.html');
  7. </script>
  8. </body>
  9. </html>

File #2 (test2.html)
HTML and CSS Syntax (Toggle Plain Text)
  1. <html>
  2. <head></head>
  3. <body>
  4. <script type="text/javascript">
  5. alert("Closing test2's window");
  6. window.close();
  7. var newWindow = window.open('/home/matt/test3.html');
  8. </script>
  9. </body>
  10. </html>

File #3 (test3.html)
HTML and CSS Syntax (Toggle Plain Text)
  1. (doesn't matter)

Opening the browser on test1.html causes test2.html to be opened in a new window, then that window is closed and test3.html is loaded in another new window.

Opening the browser on test2.html causes test3.html to be opened in another window: but the window holding test2.html doesn't close.

There was also a 'popup blocked' bar until I allowed popups from my local machine. That would be present in most browsers. Except the ultimate Opera of course..
Last edited by MattEvans; Jan 12th, 2007 at 3:12 pm.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 6
Reputation: sandeep0708 is an unknown quantity at this point 
Solved Threads: 0
sandeep0708 sandeep0708 is offline Offline
Newbie Poster

Re: new window popup

 
0
  #5
Jan 15th, 2007
the problem still persists....i can't open the new window in the same as i want to logout from the current page to a new logout page without any information to be shared ......and also can't use new window to popup with an alert ...........
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: new window popup

 
0
  #6
Jan 15th, 2007
well, if you're automatically opening windows you're always going to hit an alert on newer browsers, and you can only be sure you'll be able to close a window that you "own".

information doesn't have to be shared between the two pages. if you're worried about people pressing the 'back' button; that's a system beyond your control.

if you're using sessions (cookies/QSA) of some description, you can expire or invalidate the login; the users wont have authorititave access to your site after logging out; but they'll always be able to recall their cache.

The only way around that is 'scrambling' delivered pages and using JavaScript to 'unscramble' page content based on a cookie everytime a page loads. But even that won't stop browsers like Opera from recalling pages (it retains DOM/JS state between pages)
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 6
Reputation: sandeep0708 is an unknown quantity at this point 
Solved Threads: 0
sandeep0708 sandeep0708 is offline Offline
Newbie Poster

Re: new window popup

 
0
  #7
Jan 15th, 2007
ya ...but i would like to discuss the problem once again,and hope that some1 can give me a help..
i have a jsp page main ,containg two frames in which 2 different jsp r loaded.....one of them has a logout link....wht i want is to click on the logout link closes the main jsp page that contains both of them and opening another jsp for the logout...in a totally new window.....might b the problem is now more clear and have a quick solution..
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: new window popup

 
0
  #8
Jan 15th, 2007
You wont get a quick solution for the reason's I've already outlined. You'll need to redesign the entry to your website so that the main window is lanched using JavaScript (in order to close the main window) and accept that popup blockers / security rules might interfere with what you want to do.

Regardless of whether your page is JSP/ASP/PHP/HTML and whether you have no frames or 75 frames, th questions you want the answers to are:

- Can I close the current browser window?
Only if you opened it from script on your site, or if you're targetting browsers that ignore the rules for window ownership. Even if you 'own' the window; you may hit security problems in certain browsers, especially on high security modes.

- Can I open a new browser window without ever hitting a popup blocker?
No.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 37
Reputation: jblacdao is an unknown quantity at this point 
Solved Threads: 3
jblacdao jblacdao is offline Offline
Light Poster

Re: new window popup

 
0
  #9
Jan 24th, 2007
Originally Posted by MattEvans View Post
if you want the parent window to close when a new page opens, why not just open the new page in the same window?? O_o
I agree with Matt, why would you go all that trouble just for the logout. If you're worried about the back button on the browser, why don't you just put security measures on your pages like checking for sessions/cookies that you set when you login. If their sessions/cookies expire then warn the users and ask them log back in. Most if not all websites with logins do the same thing and they dont have problems with it.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC