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

Can't open a window after closing one, why?

In my jsp I have:

<Script langauge="Javascript">
window.location.replace("first url");
window.close();
window.open("second url");
</Script>

The child window opens from the parent window just fine and then it
closes, but I cannot reopen a new child window; I am working with IE 6
under XP.

I would have thought a simple example like this would have given me the
result I was looking for. But apparently, its not so simple since
nothing happens after the child window closes. Why won't my second
child window open?

Anything wrong with my syntax? Thanks for any and all help.

Nelson

Feb 9 '06 #1
6 1972
Here is an explanation on why it is not working.

If you open the file on your location machine, initially you will get a
activex error, but once you enable it, everything will work as desired.

But, if that file is on a webserver, like
(http://www.cnn.com/test.html), XP will block it as it considers the
window.open call as NOT user initiated. There is NO workaround for that
as you can not open automatic pop up windows under IE 6 XP. There are
however some wierd workarounds for opening pop up windows, but those do
not look professional.

- shiva vannavada

Feb 9 '06 #2
slacker said the following on 2/9/2006 4:52 PM:
In my jsp I have:

<Script langauge="Javascript">
window.location.replace("first url");
window.close();
window.open("second url");
</Script>

The child window opens from the parent window just fine and then it
closes, but I cannot reopen a new child window; I am working with IE 6
under XP.
With that code, it is a wonder that you even closed the window.
I would have thought a simple example like this would have given me the
result I was looking for. But apparently, its not so simple since
nothing happens after the child window closes. Why won't my second
child window open?


Because the code to open the window is now gone.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 10 '06 #3
sh*************@gmail.com said the following on 2/9/2006 5:17 PM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.
Here is an explanation on why it is not working.
No, that is not an explanation of why it is not working.
If you open the file on your location machine, initially you will get a
activex error, but once you enable it, everything will work as desired.
I get no activeX error when opening that file on my local machine.
But, if that file is on a webserver, like
(http://www.cnn.com/test.html), XP will block it as it considers the
window.open call as NOT user initiated.
No, XP does not block popups. IE6 does though.

There is NO workaround for that as you can not open automatic pop up
windows under IE 6 XP.
Irrelevant but finally some truth in your post.

There are however some wierd workarounds for opening pop up windows,
but those do not look professional.


"weird workarounds"?

Examples?
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

Feb 10 '06 #4

Randy Webb wrote:
sh*************@gmail.com said the following on 2/9/2006 5:17 PM:

Please quote what you are replying to.


Shiva did, at least I can see all of my post to which the user was
responding too.

Shiva, thank you for responding to a question that an individual posted
on the internet, namely and specifically me.

Randy, based on some of your responses, you seem to be somebody who is
intentionally looking to fight and argue. Good luck in your quest.

Nelson
Here is an explanation on why it is not working.

No, that is not an explanation of why it is not working.

There is NO workaround for that as you can not open automatic pop up
windows under IE 6 XP.


Irrelevant but finally some truth in your post.


Feb 10 '06 #5
slacker wrote:
In my jsp I have:
JSP are _JavaServer_ Pages. Java != JavaScript. That this code is
maybe part of JSP code has exactly no meaning regarding the execution
of the client-side script code generated by it. When it is about
client-side scripting, always post generated code, not generating one.
<Script langauge="Javascript">
window.location.replace("first url");
window.close();
window.open("second url");
</Script>
This cannot work.

1. The `script' element requires the `type' attribute:

<script type="text/javascript">

2. The `script' element does not have a `langauge' attribute.
It has a `language' attribute which is deprecated since HTML 4.0
and can be safely omitted.

<URL:http://validator.w3.org/>

3. You replace the location of the current window, with all the code in it
gone.

Then you /think/ you close the current window, but there is no close()
call left because of the former. Even if it were executed, the close()
call would then definitely remove all the currently executing code from
the memory.

Then you /think/ you call window.open(), but there is no open() call
left because of the former.

4. You do not feature-test any of these host object's methods, which is
error-prone: <URL:http://pointedears.de/scripts/test/whatami#inference>

Bottom line: You should drink much more tea[tm] when coding.
Anything wrong with my syntax?


Ask if anything is right, that answer would have been shorter: no.
PointedEars
Feb 10 '06 #6
slacker said the following on 2/10/2006 7:47 AM:
Randy Webb wrote:
sh*************@gmail.com said the following on 2/9/2006 5:17 PM:

Please quote what you are replying to.
Shiva did, at least I can see all of my post to which the user was
responding too.


Shiva did not quote anything. If you want to believe different, then
feel free to do so. But do so knowing that Shiva didn't quote anything.
Shiva, thank you for responding to a question that an individual posted
on the internet, namely and specifically me.
Are you as equally thankful for the useless response you got?
Randy, based on some of your responses, you seem to be somebody who is
intentionally looking to fight and argue.

If correcting garbage replies and asking people to honor Usenet, and
specifically comp.lang.javascript, conventions makes me one
intentionally looking to fight and argue, then so be it. But the post I
replied to not only had convention problems, it contained no less than 5
inaccuracies in a post that was only 6 sentences long. Posts like that
that get left alone end up becoming urban legends because new people
will read it and think that XP blocks popups on webpages (it doesn't)
among the other 5 inaccuracies. And that post is better off corrected
than left alone.

But, I will give you a chance here. Did the suggestion of putting your
code on a web server change the behavior of the code? I bet it doesn't
change it one bit.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 14 '06 #7

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

Similar topics

7
by: Peter Aitken | last post by:
I want to include a button that has rollover effects and also is a link to a page that will open in a new window. Here's the code I am using: <A...
3
by: ReGenesis0 | last post by:
I'm trying to rewrite the existing window using javascript. This works fine in IE- but in Mozilla, after I call a window.open, Mozilla starts wandering around like an alshiemers patient and...
2
by: John Dalberg | last post by:
I have a closed box system which opens an html page. The page closes by the system. I have access to the html page. I added code to open a child window from this page. However when the parent...
9
by: Christopher Benson-Manica | last post by:
I have the following situation: Page A opens a window named 'foo'. Page A then reloads itself. Is there a way for the reloaded Page A to determine whether there is an open window named 'foo',...
1
by: Craig Smith | last post by:
How do you open a new window and closed the parent window. ie click on link and new window opens in place of original window. Is there some way of combing window.open and window.close ? Thanks...
2
by: Jon | last post by:
I am writing an MDI app that uses a document manager class to keep track of opened child windows. I want the user to be able to close a child window, but then re-open the window from the "Window"...
1
by: SPG | last post by:
Hi, We are seeing a strange memory leak in IE (6...any) with opening and closing windows using JS When you run the code below (Assuming you have another file called leak2.html) the process...
7
by: Toccoa | last post by:
After considerable googling - I mean searching with Google(r) - I could not find javascript on a button or <a href=... to close a window in the latest versions of IE and FireFox. There seemed...
6
by: Howard Rifkin | last post by:
Hi, I my Javascript I popup an authentication window using the command; unamePasswdWindow = open("auth.html","","width=500,height=100"); This works fine in IE, and in Firefox 2.x on...
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: 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
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,...
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
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.