469,282 Members | 1,704 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

window.open(...) does not work

Inside a html page (more precicesly inside a JSP page) I defined a button.
When the user clicks this button a second browser window should pop up und load the passed
URL. I coded

<img src="mybutton.gif" onclick='window.open("http://mydomain.com", "Mytitle);'>

However when I click on the button (under Win2000 + IE5.5) no window pops up.

Why?

Are there other ways to get a new browser window?

Wladi

Jul 23 '05 #1
18 9202
Spake Wladimir Borsov unto thee:
Are there other ways to get a new browser window?


The way I do it, if I really have to do it, is to use a link like:

<a href="page.html"
onclick="window.open('page.html','','width=400,hei ght=400'); return
false;">link text</a>

That way you get a new window of whatever size you suggest if the
user agent supports it, but the page still opens if it doesn't. Of course,
there are millions of reasons why one shouldn't use new windows, but I am
not going to go into them.

--
Dylan Parry
http://webpageworkshop.co.uk - FREE Web tutorials and references
Jul 23 '05 #2
Dylan Parry wrote:
Spake Wladimir Borsov unto thee:

Are there other ways to get a new browser window?

The way I do it, if I really have to do it, is to use a link like:

<a href="page.html"
onclick="window.open('page.html','','width=400,hei ght=400'); return
false;">link text</a>


<a href="somewhere.html"
onclick="window.open(this.href,this.target,'.....' );return false">
link text</a>

Whenever I do something like that, I usually use a function and pass the
parameters though:

<a href="somewhere.html" target="_someWindow"
onclick="myFunction(this.href,this.target);return false">blah blah
</a>

Makes maintenance easier.


--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #3
Wladimir Borsov wrote:
<img src="mybutton.gif" onclick='window.open("http://mydomain.com", "Mytitle);'>


You're missing a quote mark. There are better ways to do what you're doing
though:

<a href="http://example.net/" target="Mytitle"
onclick="window.open(this.href,this.target); return false;">
<img src="mybutton.gif" alt="Go to example.net"></a>

Though popups are, of course, evil.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Jul 23 '05 #4
wl*******@gmx.net (Wladimir Borsov) wrote:
Inside a html page (more precicesly inside a JSP page) I defined a button.
That's not really any more precisely from the point of view of the
browser, which has no knowledge about or interest in how the HTML was
generated.
When the user clicks this button a second browser window should pop up und load the passed
URL. I coded

<img src="mybutton.gif" onclick='window.open("http://mydomain.com", "Mytitle);'>

However when I click on the button (under Win2000 + IE5.5) no window pops up.


For future reference, this isn't an HTML question, and there was no
need to post it to the HTML groups, but in any event, are you *sure*
you checked that all your quotation marks are paired correctly? I see
one that isn't closed.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 23 '05 #5
Dylan Parry wrote:
<snip>
The way I do it, if I really have to do it, is to use a link like:

<a href="page.html"
onclick="window.open('page.html','','width=400,hei ght=400'); return
false;">link text</a>

That way you get a new window of whatever size you suggest if the
user agent supports it, but the page still opens if it doesn't.

<snip>

That isn't necessarily true. If the pop-up blocking is being done by,
for example, Opera or Mozilla the call to window open does not error, it
just returns null. The - return false - then cancels the navigation and
the user gets nothing. Similarly, if the pop-up blocking is being done
by a content inserting proxy that replaces the - window.open - function
with a non error-producing dummy then again the - return false - cancels
the navigation and the user gets nothing.

It would be nice to be able to return a value from the onclick handler
that related to the success of the - window.open - call, but no
comprehensive test for window opening success or failure within the
calling function has been devised. On the whole I think the subject line
says it all; " window.open(...) does not work".

Richard.
Jul 23 '05 #6

"Wladimir Borsov" <wl*******@gmx.net> wrote in message
news:ch*************@news.t-online.com...
Inside a html page (more precicesly inside a JSP page) I defined a button. [1] When the user clicks this button a second browser window should pop up und load the passed URL. I coded

<img src="mybutton.gif" onclick='window.open("http://mydomain.com", "Mytitle);'>
However when I click on the button (under Win2000 + IE5.5) no window pops up.
Why? [2]

Are there other ways to get a new browser window? [3]

Wladi


Hello Wladi

[1] I was looking for a button, but no - you've defined a graphic/image on
the page, not a button. Pedantic arent I?!

[2] Without going any further on whether this is valid or should work or
whatever - purely a first-look the code syntax - shouldn't there be an end
speechmark after Mytitle (as you have started an opening speechmark)?

[3] You'd best search the previous threads on this newsgroup; you'll see how
much people hate that being forced on them.

Group: dont want to hijack Wladi's thread (but is probably relevant to his
question [3]) I totally agree with all what's been said in the past, dont
like suddenly being in a new window and having to manage it, but what are
thoughts on entering a web "application" ie interactive application not
static pages. An example go to www.amp.com.au and click on "Login" - how
would what happens there be better? Stay in the same window and keep links
within the 'application' part back to the 'launching static page' part?
(which sounds ok to me). Same for internet banking
(www.commbank.com.au/netbank and click 'start netbank', similar stuff.

Cheers
Rob
Jul 23 '05 #7
Rob Martin wrote:
"Wladimir Borsov" <wl*******@gmx.net> wrote in message
news:ch*************@news.t-online.com...
Inside a html page (more precicesly inside a JSP page) I defined a button.
[1]
When the user clicks this button a second browser window should pop up und


load the passed
URL. I coded

<img src="mybutton.gif" onclick='window.open("http://mydomain.com",


"Mytitle);'>
However when I click on the button (under Win2000 + IE5.5) no window pops


up.
Why? [2]

Are there other ways to get a new browser window? [3]

Wladi

Hello Wladi

[1] I was looking for a button, but no - you've defined a graphic/image on
the page, not a button. Pedantic arent I?!

[2] Without going any further on whether this is valid or should work or
whatever - purely a first-look the code syntax - shouldn't there be an end
speechmark after Mytitle (as you have started an opening speechmark)?

[3] You'd best search the previous threads on this newsgroup; you'll see how
much people hate that being forced on them.

Group: dont want to hijack Wladi's thread (but is probably relevant to his
question [3]) I totally agree with all what's been said in the past, dont
like suddenly being in a new window and having to manage it, but what are
thoughts on entering a web "application" ie interactive application not
static pages. An example go to www.amp.com.au and click on "Login" - how
would what happens there be better? Stay in the same window and keep links
within the 'application' part back to the 'launching static page' part?


Yes. Instead of opening a new window, simply navigate to
https://onlineservices.amp.com.au/lo...vicesLogon.asp
And have that navigate back to where you want it to go.
(which sounds ok to me). Same for internet banking
(www.commbank.com.au/netbank and click 'start netbank', similar stuff.


That one could navigate straight to:
https://www1.netbank.commbank.com.au...k/bankmain.htm
And then go from there.

Typically, if a site thinks it *requires* a popup, its an indication of
lack of knowledge on the part of the web-masters.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #8
On Wed, 8 Sep 2004 23:28:20 +0200, Wladimir Borsov <wl*******@gmx.net>
wrote:
Inside a html page (more precicesly inside a JSP page) I defined a
button.
When the user clicks this button a second browser window should pop up
und load the passed
URL. I coded

<img src="mybutton.gif" onclick='window.open("http://mydomain.com",
"Mytitle);'>

However when I click on the button (under Win2000 + IE5.5) no window
pops up.

Why?


Because there is justice in the world.
Jul 23 '05 #9
Wladimir Borsov wrote:
<img src="mybutton.gif" onclick='window.open("http://mydomain.com", "Mytitle);'>

However when I click on the button (under Win2000 + IE5.5) no window pops up.

Why?
Missing quote after Mytitle, perhaps?
Are there other ways to get a new browser window?


Yes. Let the user do it when *they* want to.
--
Mark.
http://tranchant.plus.com/
Jul 23 '05 #10
Wladimir Borsov wrote:

<img src="mybutton.gif" onclick='window.open("http://mydomain.com", "Mytitle);'>
However when I click on the button (under Win2000 + IE5.5) no window pops up.
Why?
(This is not a javascript ng.)
You are missing a trailing double quote for Mytitle.
Are there other ways to get a new browser window?

<a href="http://mydomain.com" target="_blank">foo</a>

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jul 23 '05 #11
On Thu, 09 Sep 2004 22:49:22 -0700, jmm-list-gn wrote:
(This is not a javascript ng.)
I take you mean 'this is not a JS issue'?
<a href="http://mydomain.com" target="_blank">foo</a>


( ..given your reference to a link.
Good idea, BTW )

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #12
On Fri, 10 Sep 2004 06:17:58 GMT, Andrew Thompson <Se********@www.invalid>
wrote:
On Thu, 09 Sep 2004 22:49:22 -0700, jmm-list-gn wrote:
(This is not a javascript ng.)
< I take you mean 'this is not a JS issue'?


It was originally posted to a.html, ciawh, and clj, with follow-ups set to
clj, so both statements are correct.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #13
On Fri, 10 Sep 2004 07:50:33 GMT, Michael Winter wrote:
On Fri, 10 Sep 2004 06:17:58 GMT, Andrew Thompson wrote:
On Thu, 09 Sep 2004 22:49:22 -0700, jmm-list-gn wrote:
(This is not a javascript ng.)

<
I take you mean 'this is not a JS issue'?


It was originally posted to a.html, ciawh, and clj, with follow-ups set to
clj, so both statements are correct.


I comprehend now. Thanks for clarifying.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #14
Andrew Thompson wrote:
On Thu, 09 Sep 2004 22:49:22 -0700, jmm-list-gn wrote:
(This is not a javascript ng.)
I take you mean 'this is not a JS issue'?

Oops. I did not notice it was cross-posted.
<a href="http://mydomain.com" target="_blank">foo</a>


( ..given your reference to a link. Good idea, BTW )

Thanks.

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jul 23 '05 #15
> Typically, if a site thinks it *requires* a popup, its an indication
of lack of knowledge on the part of the web-masters.


Not at all - what you are suggesting is that application developers
do away with dialog boxes. Pop-ups make sense in web applications for
many of the same reasons dialog boxes are used in normal applications

Consider a data entry application that makes extensive use of thesauri
or
controlled lists. Some are very long, so if you code them in the page,
you get really fat pages. It can be better to load them in a pop-up as
required - if the user doesn't use the long list, it's never loaded. It
also means the list can be re-used, moved, resized to suit if it needs
to
be used in various parts of the page.

Gotta admit, general web pages should try to avoid them though.
Fred.
replace smudge with au for email.
Jul 23 '05 #16
On 14 Sep 2004 14:46:58 GMT, Fred Oz <oz****@iinet.net.smudge> wrote:
Not at all - what you are suggesting is that application developers
do away with dialog boxes. Pop-ups make sense in web applications for
many of the same reasons dialog boxes are used in normal applications
except popup boxes are nothing like dialogs, and competent web UI
developers can implement much better and more usual mechanisms to
achieve what you're describing.
controlled lists. Some are very long, so if you code them in the page,
you get really fat pages. It can be better to load them in a pop-up as
required - if the user doesn't use the long list, it's never loaded.


Same can be done in page of course... and without the overhead, risk
and complication of a popup.

Jim.
Jul 23 '05 #17
In <41****************@news.individual.net> Jim Ley wrote:
except popup boxes are nothing like dialogs,
How so? They are both UI elements that can be used for whatever, the
only
real diffrence is the language used to code them. That, of itself, does
not make pop-ups bad and dialogs good.
and competent web UI developers...
So anyone who uses pop-ups is therefore incompetent? The web is not the
sole use for web technologies. Clients may actually want a pop-up for a
particular reason - why tell them they can't have it for the sake of
idealism?
Same can be done in page of course... and without the overhead, risk
and complication of a popup.


Any inteface feature may or may not work depending on the users'
environment. Consider web applications, not general web pages. In that
environment, you can ensure the user has a compatible browser and that
it
is correctly configured to make the features of your application work.
Cheers.
Jul 23 '05 #18
On 14 Sep 2004 20:35:01 GMT, Fred Oz <oz****@iinet.net.smudge> wrote:
In <41****************@news.individual.net> Jim Ley wrote:
except popup boxes are nothing like dialogs,
How so? They are both UI elements that can be used for whatever, the
only real diffrence is the language used to code them. That, of itself,
does not make pop-ups bad and dialogs good.


No, pop-up windows are first class citizens in the window manager,
dialogs rarely are - they're modal they're tied to the owner window
etc.
and competent web UI developers...


So anyone who uses pop-ups is therefore incompetent?


No, that is not a logical conclusion, all you can derive from the
statement is that people who cannot do it are not competent UI
developers.
The web is not the
sole use for web technologies. Clients may actually want a pop-up for a
particular reason - why tell them they can't have it for the sake of
idealism?


It's nothing to do with idealism, it's the problems with pop-ups that
are the reason not to, explain it to your clients and they'll
understand, if not why are they employing an expert?
Same can be done in page of course... and without the overhead, risk
and complication of a popup.


Any inteface feature may or may not work depending on the users'
environment. Consider web applications, not general web pages. In that
environment, you can ensure the user has a compatible browser and that
it is correctly configured to make the features of your application work.


Oh right, you seem to have a lot different experience of deployment of
web applications than me, where (beyond it must be IE commonly)
playing with settings is all too common - you can't go getting Large
Institution Y to change their settings for you, not least 'cos if they
did, Web Application Vendor Z would have already picked a different
potentially incompatible set-up.

There's nothing about ideology that makes pop-ups a bad idea. There
are good reasons behind it.

Jim.
Jul 23 '05 #19

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Edwin Boersma | last post: by
3 posts views Thread by kaith | last post: by
5 posts views Thread by Jorn TK | last post: by
reply views Thread by Wladimir Borsov | last post: by
2 posts views Thread by Vijay Kerji | last post: by
4 posts views Thread by dik | last post: by
9 posts views Thread by Stan B | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.