Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 29th, 2007, 11:12 PM
Registered User
 
Join Date: Jun 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem in closing the parent window from a popup

I am opening a popup on the start page of my application.Once the popup is opened,i want to close the startup page.
When i am doing this by writing
window.opener.close()
on the popup then it displayes a message box
"Do you want to close the window you are viewing yes or no"

I want the start page should be closed withouht any message.

Please help me out ,


Thanks in advance,
Rakesh Kashnia

 
Old June 30th, 2007, 12:31 AM
Authorized User
 
Join Date: Jun 2007
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi rakesh.kashnia1

IE prevents you to close a window that has no 'opener'. When you load your first page, it has no 'opener' set, so when you try to close it using script, it hints user about closing window through scripts. You can set a dummy opener for your first page to block this message.

// First page code
window.opener = "yoooohoooo";

// Popup page code
window.opener.close();

Ehsan Zaery Moghaddam
 
Old June 30th, 2007, 08:46 AM
Registered User
 
Join Date: Jun 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks budy.
It solved my issue in IE .
But its not working in mozilla?

Please help me out.


 
Old July 2nd, 2007, 02:24 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well, before writing window.opener.close, set the opener to null, e.g.

window.opener = null;
window.opener.close();

Regards
Mike

Don't expect too much, too soon.
 
Old July 9th, 2007, 05:39 AM
Registered User
 
Join Date: Jun 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

its not working in IE7 and mozilla

Please help !






Similar Threads
Thread Thread Starter Forum Replies Last Post
Close Child window automatically on closing parent vikas67k C# 1 August 26th, 2008 02:00 AM
Closing parent window from child window arnabghosh Javascript How-To 1 December 26th, 2007 01:18 AM
Centering Popup window & Blur Parent window jkusmanto Javascript How-To 0 May 25th, 2007 03:19 AM
Problem with closing popup fs22 Javascript 4 May 20th, 2004 09:37 AM
refresh the parent window when closing the popup ram_siddinen VS.NET 2002/2003 1 January 30th, 2004 04:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.