473,386 Members | 1,609 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,386 software developers and data experts.

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 1965

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='ProperPage.htm';window.c lose();">Redirect to
Proper Page</span>
</body>
</html>

main.htm

<html>
<head>
<script>
var w;
function OpenChild()
{
w = window.open("childPopup.htm");
setInterval("CheckChild()", 1000);
}
function CheckChild()
{
if (w.closed)
document.location = "ErrorPage.htm";
}
</script>
</head>
<body>
<span onclick="OpenChild()">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
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...
0
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...
9
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...
3
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:...
3
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...
2
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...
8
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 :)...
1
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....
2
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.