473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Closing a web page

I am using the following code to open another .aspx page

function viewCart() {
window.open('ShoppingCart.aspx')
}

The above function is attacked to the onClick event of a button.

However, when I use following code attached to a button on the newly opened
page, it just reposts. Basically the page should be closing itself.

function CloseCart() {
self.close;
}

All suggestions from previous posts that I could find have not worked.
Anyone know how to really do this?

WR

May 1 '06 #1
5 1411
I think you need to use "window.close();" and not "self.close; "

May 2 '06 #2
Although the self reference is not in the standard, most browsers
support it for historical reasons. It's better to use the windows
reference, though.

What makes the magical difference here is the parantheses. Nicely
spotted, I missed that one. :) Without them, you just get a reference to
the close method and throw it away.

pr******@hotmail.com wrote:
I think you need to use "window.close();" and not "self.close; "

May 2 '06 #3
Unfortunately neither

window.close() nor self.close() work.

WR

"pr******@hotmail.com" wrote:
I think you need to use "window.close();" and not "self.close; "

May 2 '06 #4
I take it back. Window.Close() does not work but window.close does.
Now my next question is how to get the calling page to refresh if a changes
was made on the called page?

wr
"Göran Andersson" wrote:
Although the self reference is not in the standard, most browsers
support it for historical reasons. It's better to use the windows
reference, though.

What makes the magical difference here is the parantheses. Nicely
spotted, I missed that one. :) Without them, you just get a reference to
the close method and throw it away.

pr******@hotmail.com wrote:
I think you need to use "window.close();" and not "self.close; "

May 2 '06 #5
Reload the page from the popup:

window.opener.location.reload(true);

WhiskyRomeo wrote:
I take it back. Window.Close() does not work but window.close does.
Now my next question is how to get the calling page to refresh if a changes
was made on the called page?

wr
"Göran Andersson" wrote:
Although the self reference is not in the standard, most browsers
support it for historical reasons. It's better to use the windows
reference, though.

What makes the magical difference here is the parantheses. Nicely
spotted, I missed that one. :) Without them, you just get a reference to
the close method and throw it away.

pr******@hotmail.com wrote:
I think you need to use "window.close();" and not "self.close; "

May 2 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: James | last post by:
Quick question about closing recordsets and connection objects. We're in the process of rewriting a TON of bad code. None of it is even remotely tabbed properly, it's impossible to read half the...
3
by: Daniel | last post by:
Is there a way to make a javascript do something when the user closes the browser? I would like it to go another url or something. I do not want this script to run when a user clicks on a link on...
1
by: MJEASSOC | last post by:
I need some help with closing a popup window. I'm making an online portfolio, that has one base page with text and thumbnails. When a user clicks on a thumb, a new window opens containing a larger...
10
by: Tom Szabo | last post by:
Is there an event when that triggers when the window is closing.... I am talking about when the user clicks on the cross on the right top corner of the window!!!
6
by: Al the programmer | last post by:
I want to catch the Closing event for my form. I created a test windows app using the wizard. I then create the Closing event by clicking the lightning bolt on the properties pane. The code is...
13
by: Simon Harvey | last post by:
Hi All, I have a colleague that I wprk with that develops using ASP. I develop using ASP.net. He seems to make sites much faster than me and I am wondering if its because of the two different...
5
by: Russell | last post by:
Hi all, I have a web page(a) that has a link to another web page(b). Now, on the page load event of web page(b), I am doing the following: Response.redirect("./test.pdf") This pdf, if the...
2
by: sylvain | last post by:
is there a simple way to detect a web window closing when the user hit the X of the browser ? I want to display a message to the user when he goes out of my web page. I try to detect it by using...
7
by: Martien van Wanrooij | last post by:
I have been faced a couple of times with the situation that I wanted to write a script and was worried about a too frequent opening and closing mysql connections. To give some examples: 1)I...
2
by: ting ting | last post by:
I am using the ASP.net 2.0 and When I load a page, it will auto pop up the Reminder page by following showModalDialog Javascript. It worked fine for the first time, after I amended some data and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.