window.open / resizeTo problem

D

David McCulloch

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

========================================

<html>
<head>
<SCRIPT LANGUAGE="JavaScript"><!--

function pgppopup() {
winobj1 = window.open('http://www.yahoo.com/', 'mywin1',
'top=0,left=0,height=120,width=120,' +
'toolbar=yes,menubar=yes,scrollbars=yes,' +
'resizable=yes,location=yes,status=yes');
winobj1.resizeTo(600,400);
}

//--></SCRIPT>

</head>
<body>
<SCRIPT LANGUAGE="JavaScript"><!--

window.onload = pgppopup;

//--></SCRIPT>

<h1>Test to Open and Resize</h1>

</body>
</html>

========================================
 
M

Mike Foster

David McCulloch said:
The following code opens a new window, but the "resizeTo" doesn't resize it.
Why not?

...

What browser are you using? Some browsers allow you to control whether or not scripts can open/resize/move/minimize/maximize windows - like Opera ;-).
 
D

David McCulloch

Mike Foster said:
David McCulloch said:

What browser are you using? Some browsers allow you to control whether or
not scripts can open/resize/move/minimize/maximize windows - like Opera ;-).

I am looking for generic code. As much as possible, I would like to be
compatible with the browsers most commonly in use today (IE6+, NS6/7, Opera
6/7, etc.).

I tested this code on IE6 under Windows XP and encountered the problem. Any
idea what the problem could be? Do you have the same problem when you click
on my web address? The window open'd window should be 600x400, not stuck at
120x120.
http://tosasoft.com/test/open.htm
 
D

Dag Sunde

David McCulloch said:
resize or
not scripts can open/resize/move/minimize/maximize windows - like Opera ;-).

I am looking for generic code. As much as possible, I would like to be
compatible with the browsers most commonly in use today (IE6+, NS6/7, Opera
6/7, etc.).

I tested this code on IE6 under Windows XP and encountered the problem. Any
idea what the problem could be? Do you have the same problem when you click
on my web address? The window open'd window should be 600x400, not stuck at
120x120.
http://tosasoft.com/test/open.htm

This fails silently on one of my computers, and shows:
"Error on Line 9, winobj1 is null or not an object"
on another, where I have script-debugging turned on.

Both of course because I'm using Google's PopUp Blocker.
 
D

DU

David said:
not scripts can open/resize/move/minimize/maximize windows - like Opera ;-).

I am looking for generic code. As much as possible, I would like to be
compatible with the browsers most commonly in use today (IE6+, NS6/7, Opera
6/7, etc.).

Most people using browsers most commonly in use (MSIE 6, NS 7.x, Opera
7.x, Mozilla-based browsers, Safari 1.x, Konqueror 3.x, etc.) have
browser user prefs settings, add-ons, browser extensions which prevent
opening new window during load time and which prevent resizing of
existing windows and this is exactly what your code attempts to do.
There is a very wide consensus among current browser manufacturers on
giving absolute veto power to users over opening unsollicited windows
and on scripts resizing windows.
I tested this code on IE6 under Windows XP and encountered the problem. Any
idea what the problem could be?

Don't open secondary window during load process of a window.

Do you have the same problem when you click
on my web address?

Yes. As your web address is still in the process of being loaded, your
code tries to open another window which I was not made aware of in the
first place. Why?

The window open'd window should be 600x400,

and then it tries to resize that window and this without notifying me in
advance and without my explicit consent to begin with.

not stuck at

As you start/open your tv or when you switch to a channel, would you
mind if the tv content provider would be able to open your other tv set
in your home?
When you start/open your tv or when you switch to a channel, would you
mind if the tv content provider would then be able to set the volume of
your other tv?

DU
 
D

David McCulloch

Dag Sunde said:
This fails silently on one of my computers, and shows:
"Error on Line 9, winobj1 is null or not an object"
on another, where I have script-debugging turned on.

Both of course because I'm using Google's PopUp Blocker.

I have been using Google's toolbar PopUp Blocker for a long time, too. Of
course, I enabled pop-ups on my site. With script-debugging enabled, I
don't see an error.

If you enable Google's pop-ups for my site (simply click the button that
shows the number of pop-ups blocked; you can disable it again by clicking a
second time), do you see the same problem?

Thanks very much for your help!

Dave
 
D

David McCulloch

DU said:
Most people using browsers most commonly in use (MSIE 6, NS 7.x,
Opera 7.x, Mozilla-based browsers, Safari 1.x, Konqueror 3.x, etc.) have
browser user prefs settings, add-ons, browser extensions which prevent
opening new window during load time and which prevent resizing of
existing windows and this is exactly what your code attempts to do.
There is a very wide consensus among current browser manufacturers
on giving absolute veto power to users over opening unsollicited
windows and on scripts resizing windows.

Understood. My users definitely want the windows to open and will be
willing to authorize my site to open them.
Don't open secondary window during load process of a window.

Technically, as part of the ONLOAD event, isn't it being opened AFTER the
first window has already been loaded? Are you suggesting that putting the
window.open into the ONLOAD event is causing this problem?

Any idea why?
As your web address is still in the process of being loaded, your
code tries to open another window which I was not made aware of in
the first place. Why?

It's part of a much more involved application, whose core value is the
opening of several dedicated windows. The users definitely want and expect
them to open.
The window open'd window should be 600x400,

and then it tries to resize that window and this
without notifying me in advance and without my
explicit consent to begin with.

That would not be true in the context of my application. Its users
definitely want and expect multiple windows to open. Unfortunately, that's
not what is happening.
As you start/open your tv or when you switch to a channel, would you
mind if the tv content provider would be able to open your other tv set
in your home?
When you start/open your tv or when you switch to a channel, would you
mind if the tv content provider would then be able to set the volume of
your other tv?

Without going too far off-topic, suffice to say that I agree with you in
general terms (and in almost all situations), but that is really not an
issue here. On the contrary. Part of my application's core value to its
users is to do exactly that. Without knowing more details, I don't expect
you to understand, but if I can get it up and running, I plan to give
everyone (not just my family and friends) free access and you could see for
yourself. In the meantime, any help would be appreciated. Thanks!

Dave
 
M

Mike Foster

David said:
not scripts can open/resize/move/minimize/maximize windows - like Opera
;-).

I am looking for generic code. As much as possible, I would like to be
compatible with the browsers most commonly in use today (IE6+, NS6/7,
Opera
6/7, etc.).

I tested this code on IE6 under Windows XP and encountered the problem.
Any
idea what the problem could be? Do you have the same problem when you
click
on my web address? The window open'd window should be 600x400, not
stuck at
120x120.
http://tosasoft.com/test/open.htm

I copied the code you posted and tried it on my local machine with
IE6/Win2K. I received an "access denied" error. When I changed the url to
a local file it worked properly. This may be related to the same security
issue when trying to access the DOM of a remote page.

David said:
(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!)

You could try the following but it actually opens the window larger than
it needs to be so you have to estimate how much to subtract.

'height=' + (screen.height-140) +
',width=' + (screen.width-10) + ',' +
 
D

Dag Sunde

David McCulloch said:
I have been using Google's toolbar PopUp Blocker for a long time, too. Of
course, I enabled pop-ups on my site. With script-debugging enabled, I
don't see an error.

If you enable Google's pop-ups for my site (simply click the button that
shows the number of pop-ups blocked; you can disable it again by clicking a
second time), do you see the same problem?
No, this time I get an "Permission Denied" on the same line...
 
L

Lasse Reichstein Nielsen

David McCulloch said:
Understood. My users definitely want the windows to open and will be
willing to authorize my site to open them.

Then your users are not average. Configuring the browser to allow some
pages to open windows requires a better knowledge of their browser
than what is needed to disable unrequested popups. It can easily be
beyond the ability of many users.

I suggest supplying a button or link that they can press to open the
window if it didn't open automatically.
Technically, as part of the ONLOAD event, isn't it being opened AFTER the
first window has already been loaded?

Yes. What really matters is that it is not prompted by a user input.
Clicking or pressing a key to activate a button means that the user
is supposed to have requested the result, and window opened in response
to such will work in the advanced popup blockers.
Are you suggesting that putting the window.open into the ONLOAD
event is causing this problem?

Definitly. Every popup blocker that I have seen will block that.
It's part of a much more involved application, whose core value is the
opening of several dedicated windows. The users definitely want and expect
them to open.

It's still a potential usability problem if the users are unable to make
them open.

/L
 
D

David McCulloch

Lasse Reichstein Nielsen said:
Then your users are not average. Configuring the browser to allow some
pages to open windows requires a better knowledge of their browser
than what is needed to disable unrequested popups. It can easily be
beyond the ability of many users.

Great minds think alike -- already planned!

I know that there are many different kinds of pop-up killers. I plan to
provide instructions for the ones that my users have installed. I almost
look forward to Microsoft's SP2. It is supposed to have a built-in pop-up
supressor. At least there is hope for a relative standard sometime in the
future.
I suggest supplying a button or link that they can press to open the
window if it didn't open automatically.

Understood. Unfortunately, that would defeat one of the primary puposes of
this application.
Definitly. Every popup blocker that I have seen will block that.

Why would I be able to OPEN the window and not be able to RESIZE it?
It's still a potential usability problem if the users are unable to make
them open.

True. That's one problem that I am dealing with. Right now, my biggest
problem is why I can open a window and not resize it? I want to offer my
users the option of opening their windows in a maximized state without using
the horrible FULLSCREEN option. Unfortunately, different browsers use
different methods for calculating the proper window.open parms to accomplish
that. Any help there would be greatly appreciated.

Thanks for your help, Lasse!

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,734
Latest member
manin

Latest Threads

Top