Connecting Tech Pros Worldwide Help | Site Map

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

  #1  
Old February 9th, 2006, 10:05 PM
slacker
Guest
 
Posts: 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

  #2  
Old February 9th, 2006, 10:25 PM
shiva.vannavada@gmail.com
Guest
 
Posts: n/a

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


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

  #3  
Old February 10th, 2006, 03:55 AM
Randy Webb
Guest
 
Posts: n/a

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


slacker said the following on 2/9/2006 4:52 PM:[color=blue]
> 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.[/color]

With that code, it is a wonder that you even closed the window.
[color=blue]
> 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?[/color]

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/
  #4  
Old February 10th, 2006, 04:05 AM
Randy Webb
Guest
 
Posts: n/a

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


shiva.vannavada@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.
[color=blue]
> Here is an explanation on why it is not working.[/color]

No, that is not an explanation of why it is not working.
[color=blue]
> 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.[/color]

I get no activeX error when opening that file on my local machine.
[color=blue]
> 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.[/color]

No, XP does not block popups. IE6 does though.

[color=blue]
> There is NO workaround for that as you can not open automatic pop up
> windows under IE 6 XP.[/color]

Irrelevant but finally some truth in your post.

[color=blue]
> There are however some wierd workarounds for opening pop up windows,
> but those do not look professional.[/color]

"weird workarounds"?

Examples?


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

  #5  
Old February 10th, 2006, 12:55 PM
slacker
Guest
 
Posts: n/a

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



Randy Webb wrote:[color=blue]
> shiva.vannavada@gmail.com said the following on 2/9/2006 5:17 PM:
>
> Please quote what you are replying to.[/color]

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
[color=blue][color=green]
> > Here is an explanation on why it is not working.[/color]
> No, that is not an explanation of why it is not working.[/color]
[color=blue][color=green]
> > There is NO workaround for that as you can not open automatic pop up
> > windows under IE 6 XP.[/color]
>
> Irrelevant but finally some truth in your post.[/color]

  #6  
Old February 10th, 2006, 07:05 PM
Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a

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


slacker wrote:
[color=blue]
> In my jsp I have:[/color]

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.
[color=blue]
> <Script langauge="Javascript">
> window.location.replace("first url");
> window.close();
> window.open("second url");
> </Script>[/color]

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.
[color=blue]
> Anything wrong with my syntax?[/color]

Ask if anything is right, that answer would have been shorter: no.


PointedEars
  #7  
Old February 14th, 2006, 05:35 AM
Randy Webb
Guest
 
Posts: n/a

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


slacker said the following on 2/10/2006 7:47 AM:[color=blue]
> Randy Webb wrote:[color=green]
>> shiva.vannavada@gmail.com said the following on 2/9/2006 5:17 PM:
>>
>> Please quote what you are replying to.[/color]
>
> Shiva did, at least I can see all of my post to which the user was
> responding too.[/color]

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.
[color=blue]
> Shiva, thank you for responding to a question that an individual posted
> on the internet, namely and specifically me.[/color]

Are you as equally thankful for the useless response you got?
[color=blue]
> Randy, based on some of your responses, you seem to be somebody who is
> intentionally looking to fight and argue.[/color]


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/
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
opening a new window from a HTA Andrew Poulos answers 3 November 15th, 2007 06:15 AM
How to close a window after form is submitted? Seth E Seligman answers 2 July 20th, 2005 09:45 AM
Session Variables Persist Across Window Close on Mac IE 4.5 and Greater Pack Fan answers 9 July 19th, 2005 07:05 AM