473,799 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript redirect

Hello!

Could someone please help me on the following case.
I have a page that opens a popup/child-window (window.open(.. .)). This
childwindow redirects the mainwindow and closes itself if everything is
ok.
BUT, the problem is when a user closes the childwindow using the x
before redirect has activatet from the childwindow. Then the mainwindow
is stuck on the waiting page.
However, I get the mainwindow to check if child is closed using
onfocus, and then redirect to a error page, but this even fires if the
childwindow redirects ok and closes. (Because of the onfocus event).
So the problem is that it will always redirect to the same page
(errorpage) and not take any notice of the redirect from the
childwindow.

So is there a way for me to check if the page is allready being
redirected or that the childwindow just closed with no redirect?

Thanks!

/Mr. T

Aug 11 '06 #1
1 1983

th************* *@gmail.com написав:
However, I get the mainwindow to check if child is closed using
onfocus,
Use standard property window.closed to test window state instead of
window.focus()
and then redirect to a error page, but this even fires if the
childwindow redirects ok and closes.
Redirect main window before closing child window and then close child
window.

E.g.
child.htm

<html>
<head>
</head>
<body>
<span
onclick="opener .location='Prop erPage.htm';win dow.close();">R edirect to
Proper Page</span>
</body>
</html>

main.htm

<html>
<head>
<script>
var w;
function OpenChild()
{
w = window.open("ch ildPopup.htm");
setInterval("Ch eckChild()", 1000);
}
function CheckChild()
{
if (w.closed)
document.locati on = "ErrorPage.htm" ;
}
</script>
</head>
<body>
<span onclick="OpenCh ild()">open child</span>
</body>
</html>

Aug 11 '06 #2

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

Similar topics

1
4189
by: Ryann | last post by:
I hate javascript looking for help. I am trying to pass hidden fields around without showing a query string in the address bar. e.g. formA.asp not formA.asp?var1=blah&var2=blah I have this going okay so far using forms, hidden fields, and javascript hyperlinks on most pages.
0
6439
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to be modified: if(e.CommandName =="Print") { string parsedreceipt = null; parsedreceipt = DecodeReceipt (e.Item.Cells.Text); Session = parsedreceipt;
9
3061
by: SHarris | last post by:
Hello, In our new intranet ASP.NET project, two requirements are that the browser accept cookies AND JavaScript. We are requiring the use of Internet Explorer 6+. 1. Using C# in an ASP.NET application, how can we code the project to check to make sure the browser accepts cookies? 2. Where would we put this code? In Global.asax? 3. Using C# in an ASP.NET application, how can we code the project to detect and make sure the browser...
3
2127
by: Shapper | last post by:
Hello, I am working on an ASP.NET/VB web site. I have several links including menu links. Considerer a want to load a page named page.aspx. I can do it using javascript. Or using this code: Sub loadPage(sender As Object, e As System.EventArgs, pageURL as String)
3
4521
by: TJ | last post by:
Hi, I would like to ask something to user after user submits the form... I know I can ask user whehter they want to submit the form or not using client-script code such as onClick or onSubmit by adding into attributes collections... My problem is a little bit different than that... I would like to ask user something after submission is done
2
3922
by: SteveSu | last post by:
Hi! I want to make a postback when the user hits the escape-button on the keyboard and redirect the user to another page. But the response.redirect does not work for me in this "context". Im trying to do like this: <body onkeydown="MyRedirect()">
8
2855
by: Taras_96 | last post by:
Hi everyone, We' ve come to the conclusion that we wish the user to be directed to an error page if javascript is disabled <enter comment about how a webpage shouldn't rely on javascript here :) >. I've read quite a few posts on how to do this, but none meet my need (the two main suggestions was set a jsEnabled variable in a <scriptsection of the HTML and read it in PHP, and the other suggestion was by default loading the non js page,...
1
4370
by: rkagrawal | last post by:
I am not sure if this is the right forum to post about this problem , but , i just want to discuss a problem i recently encountered. I was developing a page in ASP , where i came across a problem. The last few lines of code were like this : '------ Popup page response.write("<script language=javascript>alert('Hello')</script>") response.write("<script...
2
1976
by: Seth Williams | last post by:
In the middle of my event handler (for a button), I have an if/then statement (using vb.net): if (whatever) then strScript="<script ....... strScript &= alert('This is an alert') strscript &="</script> ' this is all an abbreviated script - - but you get the idea response.write(strscript) end if response.redirect("another page.aspx")
2
5118
by: Rahina | last post by:
I am working in Dreamweaver 8, and I have created a simple form: http://www.realmofmystery.com/app.html This is a free website I am doing for some friends, so nothing fancy. And, I learned web design before all the CGI and PHP stuff got big, so I prefer to do things simply. The form worked fine, emails the results like perfect, but it refused to redirect the page to the confirmation. I thought I could add an onClick to the submit button,...
0
9689
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10495
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10269
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10248
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10032
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7573
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5597
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.