473,771 Members | 2,297 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.g if" 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 9466
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.htm l','','width=40 0,height=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.htm l','','width=40 0,height=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="_someWi ndow"
onclick="myFunc tion(this.href, this.target);re turn false">blah blah
</a>

Makes maintenance easier.


--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #3
Wladimir Borsov wrote:
<img src="mybutton.g if" 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.g if" 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.n et (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.g if" 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.htm l','','width=40 0,height=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.g if" 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 "applicatio n" 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.g if" 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 "applicatio n" 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.javas cript 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.g if" 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.g if" 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

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

Similar topics

3
10178
by: Edwin Boersma | last post by:
Hi, I've just installed Netscape 7.1 for Linux and the following script refuses to open a window when I call this function: function OpenLinkWindow() { wMap=window.open('http://naxos.orangeport.net/cyclades-info/ShowMap.php?id_advert=45&map=','','width=400,height=600'); wMap.onResize = 'self.location.href=http://naxos.orangeport.net/cyclades-info/ShowMap.php?id_advert=45&map='
3
2012
by: kaith | last post by:
The following code used to popup a window when I used netscape 4.79. Now I switched to mozilla 1.4 and the window doesn't popup. function newWindow(newContent) { winContent =window.open(newContent,'nextWin','screenX=0,screenY=20,width=600....); winContent.focus(); } ....
5
7094
by: Jorn TK | last post by:
Hi, i use window.open to display the result of polls window.open('../poll.php?schid=".$schid."&permit=1&pollid=".$dbpoll."&answ='+opt,'','menubar=no,width=250,height=230'); it work fine in IE but does not work with firefox, is there error in the code? Thanks & Regards
0
1459
by: Wladimir Borsov | last post by:
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?
0
840
by: drumbum | last post by:
I need to know how to delet the resent work space and the open work space fromthe drop down menue
2
1915
by: Vijay Kerji | last post by:
Hi: I have a child window which is opened by parent using ShowModalDialog. Child has a button called Add and its click handler at server tries to close the window as below. private void Button_Add_Click(object sender, System.EventArgs e) { string strscript = "<script language=javascript>window.top.close();</script>";
4
1226
by: dik | last post by:
Hi I have a page with a button that has to open a popup window: btnPopup.Attributes.Add("onclick", "window.open("popup.aspx",null,'height=250, width=250,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');"); the error is:could not find page popup.aspx what could be wrong? ch Dik
9
4657
by: Stan B | last post by:
I create a popup window by calling window.showModalDialog Popup window has Ok button with this code attached: === string Script = "<script language=JavaScript>" + "{" + "window.close();" + "}" + "</script>";
13
3560
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains some javascript code that calls window.open. I pass the resource url of page B to Page A's window.open call. Page B is then loaded and executed but none of the server-side code is rendered. If I view the source of the page, the code (and page...
0
9619
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10260
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10102
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9910
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.