473,545 Members | 2,543 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with window.open()

Hi guys

The following code works just fine in Netscape on MacOS and Windows. But in
Explorer on MacOS and Windows it throws a type mismatch error at the point
marked with the comment ³// bug out at this point². (The functions that are
called, but not listed here work fine in both Netscape and Explorer in this
and other contexts, so I can confidently discount them as the source of any
error.)

I have also tried just a plain and simple ³window.open()² command with
appropriate parameters, but to no avail. Explorer just does not seem to like
the command. But that is just plain stupid... Microsoft canıt possibly be
wrong, it must be me that is screwing up.

Any help will be most appreciated.

All the best

Ian
var bulletinSignupW indow

function displayBulletin Signup () {
var theURL = "bulletinsignup .htm";
var winName = "Bulletin Signup";
var features = "scrollbars=yes ,";
features += "location=n o,";
features += "toolbar=no ,";
features += "menuBar=no ,";
features += "directories=no ,";
features += "status=no, ";
features += "resizable=no," ;
features += "width=500, ";
features += "height=500 ,";
features += "left=30,";
features += "top=30";

bulletinSignupW indow =
openDisplayWind ow(bulletinSign upWindow,theURL ,winName,featur es);
}

function openDisplayWind ow (windowRef,cont entURL,windowNa me,features) {
var whichBrowser = checkBrowser();
var nullWindow;

switch (whichBrowser) {
case "Netscape":
nullWindow = undefined;
break;
case "Explorer":
nullWindow = null;
break;
default:
nullWindow = undefined;
break;
}

if (windowRef == nullWindow) {
windowRef = window.open(con tentURL,windowN ame,features);

if (windowRef != nullWindow) {
windowRef.focus ();
}
else {
alert("The " + quoteString(win dowName,SQUOTE) + " window cannot be
opened. You might be low on memory.");
}
} ³// bug out at this point²
else {
windowRef.focus ();
}

return windowRef;
}
Jul 23 '05 #1
4 2126
DU
Ian Sedwell wrote:
Hi guys

The following code works just fine in Netscape on MacOS and Windows. But in
Explorer on MacOS and Windows it throws a type mismatch error at the point
marked with the comment ³// bug out at this point². (The functions that are
called, but not listed here work fine in both Netscape and Explorer in this
and other contexts, so I can confidently discount them as the source of any
error.)

I have also tried just a plain and simple ³window.open()² command with
appropriate parameters, but to no avail. Explorer just does not seem to like
the command. But that is just plain stupid... Microsoft canıt possibly be
wrong, it must be me that is screwing up.

Any help will be most appreciated.

All the best

Ian
var bulletinSignupW indow
var bulletinSignupW indow = null;

function displayBulletin Signup () {
var theURL = "bulletinsignup .htm";
var winName = "Bulletin Signup";
winName must be a one word string without any blank spaces. This is a
well known issue with MSIE 5+.
var features = "scrollbars=yes ,";
features += "location=n o,";
features += "toolbar=no ,";
features += "menuBar=no ,";

features += "directories=no ,";
features += "status=no, ";
It's pointless, useless and very anti-user to try to remove the status
bar. MSIE 6 SP2, NS 6.2+, Opera 7.x and many other browsers allow the
users, give the users absolute veto power to force presence of status
bar. Why do you want your users to not be able to see http connections,
download, transfer, messages, notifications. Why are you trying to
remove the chrome bar by which I can see if the security padlock icon
(SSL) is locked or opened?
features += "resizable=no," ;
So you want to prevent your users from resizing their own browser
window? How user-friendly of you!
features += "width=500, ";
features += "height=500 ,";
If your user's screen is 640x480, then your window position and
dimensions will be corrected by modern browsers. Now, your anti-user
window features will then make the window you created unusable. Even
with a 800x600, your requested height value might be too strict, too
short in a minority of cases.
features += "left=30,";
features += "top=30";

Why do you slow down the whole process of creating that string with 12
string appending.
bulletinSignupW indow =
openDisplayWind ow(bulletinSign upWindow,theURL ,winName,featur es);

You can replace everything above and everything under (the whole
openDisplayWind ow) with this:

if(bulletinSign upWindow == null || bulletinSignupW indow.closed)
{
bulletinSignupW indow = openDisplayWind ow("bulletinsig nup.htm",
"BulletinSignup ", "scrollbars,sta tus,resizable") ;
}
else
{
bulletinSignupW indow.focus();
};
Often, not defining position and dimensions is better than defining
these values. The reasoning is that the os stores these values as
persistent data so that the next non-maximized window being opened
without strict values will use these stored values.
There is another policy also: make position and dimensions values
entirely proportional, scaled to the user's application workarea values
(it's a bit more complicated but it works).
}

function openDisplayWind ow (windowRef,cont entURL,windowNa me,features) {
var whichBrowser = checkBrowser();
var nullWindow;

switch (whichBrowser) {
case "Netscape":
nullWindow = undefined;
break;
case "Explorer":
nullWindow = null;
break;
default:
nullWindow = undefined;
break;
}

if (windowRef == nullWindow) {
windowRef = window.open(con tentURL,windowN ame,features);

if (windowRef != nullWindow) {
windowRef.focus ();
Not optimized here too. You only need 1 if..else; not 2 if(){..} .
}
else {
alert("The " + quoteString(win dowName,SQUOTE) + " window cannot be
opened. You might be low on memory.");
Not low on memory. One string without blank spaces.
}
} ³// bug out at this point²
else {
windowRef.focus ();
}

return windowRef;

This whole openDisplayWind ow function can be replaced by much more
efficient code without jeopardizing cross-browser interoperabilit y.

}


DU
--
The site said to use Internet Explorer 5 or better... so I switched to
Netscape 7.2 :)
Jul 23 '05 #2
Hi DU

Many thanks for your response. I appreciate the technical assistance.

As for the actual use of windows in web sites, I have a great deal of
sympathy with all that you say. I am not actually in favour of using
multiple windows in a web site. Hitherto, I have always used frames or <div>
layers to do what the client wants done here. But it is the client's choice.
I have made my case in favour of what I think both you and I would agree is
the more "friendly" way of doing things, but...

As to the size of the window. That's a red-herring. The dimensions in my
code are quite arbitrary. For the convenience of people of reading the code
I had posted as an exemplar, I had removed the code that tested the user's
screen size, set the window size accordingly and inserted scroll bars if
required. In fact this window (one of four the client wants) will only ever
contain a small table of results and there would be no point in making it
scrollable or resizable, unless the screen was too small. For the others,
that is not the case, they will contain considerable chunks of information
and so must scroll, though for cosmetic reasons I will still not allow them
to be resized. And none of them will have address, tool, menu or status
bars, either - on the client's instruction - so you can continue with your
admonishments!

Thanks again

Ian

On 2004/09/04 17:57, in article 2p************@ uni-berlin.de, "DU"
<dr*******@hotN OSPAMmail.com> wrote:
Ian Sedwell wrote:
Hi guys

The following code works just fine in Netscape on MacOS and Windows. But in
Explorer on MacOS and Windows it throws a type mismatch error at the point
marked with the comment ³// bug out at this point². (The functions that are
called, but not listed here work fine in both Netscape and Explorer in this
and other contexts, so I can confidently discount them as the source of any
error.)

I have also tried just a plain and simple ³window.open()² command with
appropriate parameters, but to no avail. Explorer just does not seem to like
the command. But that is just plain stupid... Microsoft canıt possibly be
wrong, it must be me that is screwing up.

Any help will be most appreciated.

All the best

Ian
var bulletinSignupW indow


var bulletinSignupW indow = null;

function displayBulletin Signup () {
var theURL = "bulletinsignup .htm";
var winName = "Bulletin Signup";


winName must be a one word string without any blank spaces. This is a
well known issue with MSIE 5+.
var features = "scrollbars=yes ,";
features += "location=n o,";
features += "toolbar=no ,";
features += "menuBar=no ,";

features += "directories=no ,";
features += "status=no, ";


It's pointless, useless and very anti-user to try to remove the status
bar. MSIE 6 SP2, NS 6.2+, Opera 7.x and many other browsers allow the
users, give the users absolute veto power to force presence of status
bar. Why do you want your users to not be able to see http connections,
download, transfer, messages, notifications. Why are you trying to
remove the chrome bar by which I can see if the security padlock icon
(SSL) is locked or opened?
features += "resizable=no," ;


So you want to prevent your users from resizing their own browser
window? How user-friendly of you!
features += "width=500, ";
features += "height=500 ,";


If your user's screen is 640x480, then your window position and
dimensions will be corrected by modern browsers. Now, your anti-user
window features will then make the window you created unusable. Even
with a 800x600, your requested height value might be too strict, too
short in a minority of cases.
features += "left=30,";
features += "top=30";


Why do you slow down the whole process of creating that string with 12
string appending.
bulletinSignupW indow =
openDisplayWind ow(bulletinSign upWindow,theURL ,winName,featur es);

You can replace everything above and everything under (the whole
openDisplayWind ow) with this:

if(bulletinSign upWindow == null || bulletinSignupW indow.closed)
{
bulletinSignupW indow = openDisplayWind ow("bulletinsig nup.htm",
"BulletinSignup ", "scrollbars,sta tus,resizable") ;
}
else
{
bulletinSignupW indow.focus();
};
Often, not defining position and dimensions is better than defining
these values. The reasoning is that the os stores these values as
persistent data so that the next non-maximized window being opened
without strict values will use these stored values.
There is another policy also: make position and dimensions values
entirely proportional, scaled to the user's application workarea values
(it's a bit more complicated but it works).
}

function openDisplayWind ow (windowRef,cont entURL,windowNa me,features) {
var whichBrowser = checkBrowser();
var nullWindow;

switch (whichBrowser) {
case "Netscape":
nullWindow = undefined;
break;
case "Explorer":
nullWindow = null;
break;
default:
nullWindow = undefined;
break;
}

if (windowRef == nullWindow) {
windowRef = window.open(con tentURL,windowN ame,features);

if (windowRef != nullWindow) {
windowRef.focus ();


Not optimized here too. You only need 1 if..else; not 2 if(){..} .
}
else {
alert("The " + quoteString(win dowName,SQUOTE) + " window cannot be
opened. You might be low on memory.");


Not low on memory. One string without blank spaces.
}
} ³// bug out at this point²
else {
windowRef.focus ();
}

return windowRef;

This whole openDisplayWind ow function can be replaced by much more
efficient code without jeopardizing cross-browser interoperabilit y.

}


DU


Jul 23 '05 #3
On Sun, 5 Sep 2004 16:34:16 +0000 (UTC), Ian Sedwell
<ia*********@bt click.com> wrote:
I will still not allow them
to be resized. And none of them will have address, tool, menu or status
bars, either - on the client's instruction - so you can continue with your
admonishment s!


So what are you going to do about the fact that much of what you've
just described is impossible in IE6 SV1 (currently only in XP SP2 but
will be in other IE6's soon)

Jim.
Jul 23 '05 #4
Hi Jim

That is my understanding too. Thank you for confirming it. I haven't looked
at the issue in detail myself, but I have seen some technical papers. Which
is one of the reasons I have been arguing with my client against the use of
these windows in any case. The other is I do not like multi-window web
sites. It seems to that it is poor practice for a good number of reasons
that need not be rehearsed here.

As to what I am going to do... Well, I am naturally exercising due diligence
and I have an entirely frame-based version that I will produce as if by
magic from a hat as soon as the client complains that people can't use his
web site :-)

All the best

Ian

On 2004/09/05 17:44, in article 41************* ***@news.indivi dual.net, "Jim
Ley" <ji*@jibbering. com> wrote:
On Sun, 5 Sep 2004 16:34:16 +0000 (UTC), Ian Sedwell
<ia*********@bt click.com> wrote:
I will still not allow them
to be resized. And none of them will have address, tool, menu or status
bars, either - on the client's instruction - so you can continue with your
admonishments!


So what are you going to do about the fact that much of what you've
just described is impossible in IE6 SV1 (currently only in XP SP2 but
will be in other IE6's soon)

Jim.


Jul 23 '05 #5

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

Similar topics

4
7575
by: Anna Quick | last post by:
I am quite new to javascript, and don't seem to find the problem with stupid internet explorer. The script works fine in safari and mozilla. I searched the groups, but evidently put in the wrong keywords, didn't find the solution. It seems to be as easy as it gets: open a new window with a new url. in IE (I am using IE in mac osx), the error...
5
10866
by: Mike | last post by:
In my previous post, I wrote: > ... > GOAL: (very simple) Provide a hyperlink which, when clicked, > calls a javascript function which opens a new URL. > ... > PROBLEM: The following code works fine if I click to open in > the same window, but if I click the browser option to open in a > new window, the new window tries to open the...
10
6715
by: David McCulloch | last post by:
The following code opens a new window, but the "resizeTo" doesn't resize it. Why not? (Don't ask why I simply did not open the window with the new size....my original problem was how to open a new window with maximized dimensions!) FYI, I uploaded the same code to: http://tosasoft.com/test/open.htm ...
2
3492
by: Samir Pandey | last post by:
Hello, I am using the following javascript code to open a new window. Somehow, IE always opens a new window. It doesn't open target url in the window name given. All i want is, if there is a window "MyWin" already open, then the main window should load the target url in "MyWin" and not open a new window again.
5
1947
by: Richard Trahan | last post by:
I have an inscrutable problem with window.open. Consider the following code: var graphwin = window.open("","graphWin","height=400,width=400,resizable=yes"); It works perfectly in one place in my program. The window opens, I write stuff to it, close the document, and it sits there like it's supposed to. I put the identical line in a...
4
2417
by: VR | last post by:
First, greetings to everyone :) I'm doing a university seminar & I've encountered a problem. I have a gallery with thumbnails linked on pictures. What I want is popup to be opened with dimensions of linked picture after clicking on a thumbnail. I found javascript which is compatible with IE, Firefox & Opera but I can't get it to work. All...
18
3308
by: len.hartley | last post by:
Hi, I am trying to pop-up a window when the user clicks on an image. The problem is that when the user clicks on the image and the window pops up OK, but the window underneath also proceeds to the image. The desired behavior is that when the pop-up is invoked, I want the underlying window to stay put. I don't have this problem when I...
0
1161
by: Aryan | last post by:
Hi, I am doing "Export to Excel" functionality, but while doing this I am getting error. Like I have two types of Report, each type has many sub reports inside. So I am opening new window for Each type of report by taking help from Javascript "window.open()" and passing different type of window name. Given below example will help you to...
0
1183
by: Aryan | last post by:
Hi, I am doing "Export to Excel" functionality, but while doing this I am getting error. Like I have two types of Report, each type has many sub reports inside. So I am opening new window for Each type of report by taking help from Javascript "window.open()" and passing different type of window name. Given below example will help you to...
0
1221
by: Aryan | last post by:
Hi, I am doing "Export to Excel" functionality, but while doing this I am getting error. Like I have two types of Report, each type has many sub reports inside. So I am opening new window for Each type of report by taking help from Javascript "window.open()" and passing different type of window name. Given below example will help you to...
0
7396
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...
0
7805
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...
1
7413
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...
0
7751
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...
1
5323
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3440
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1874
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1012
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.