By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,730 Members | 1,156 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,730 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a

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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.