By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,635 Members | 2,188 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,635 IT Pros & Developers. It's quick & easy.

window.open / resizeTo problem

P: n/a
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>

========================================
Jul 23 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
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 ;-).
Jul 23 '05 #2

P: n/a

"Mike Foster" <mi********@mfosternospam.com> wrote in message
news:op**************@news.charter.net...
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 ;-).

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
Jul 23 '05 #3

P: n/a
"David McCulloch" <|@|.|> wrote in message
news:Vd******************@twister.rdc-kc.rr.com...

"Mike Foster" <mi********@mfosternospam.com> wrote in message
news:op**************@news.charter.net...
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 ;-).
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.

--
Dag
5826'15.9" N 00846'45.5" E
Jul 23 '05 #4

P: n/a
DU
David McCulloch wrote:
"Mike Foster" <mi********@mfosternospam.com> wrote in message
news:op**************@news.charter.net...
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 ;-).

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 120x120.
http://tosasoft.com/test/open.htm


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
Jul 23 '05 #5

P: n/a

"Dag Sunde" <ds@orion.no-way> wrote in message
news:lT*****************@juliett.dax.net...
"David McCulloch" <|@|.|> wrote in message
news:Vd******************@twister.rdc-kc.rr.com...

"Mike Foster" <mi********@mfosternospam.com> wrote in message
news:op**************@news.charter.net...
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 ;-).


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.


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
Jul 23 '05 #6

P: n/a

"DU" <dr*******@hotWIPETHISmail.com> wrote in message
news:cb**********@news.eusc.inter.net...
David McCulloch wrote:
"Mike Foster" <mi********@mfosternospam.com> wrote in message
news:op**************@news.charter.net...
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 ;-).
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.


Understood. My users definitely want the windows to open and will be
willing to authorize my site to open them.
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.


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?
Do you have the same problem when you click
on my web address?


Yes.


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.
not stuck at 120x120.
http://tosasoft.com/test/open.htm


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
Jul 23 '05 #7

P: n/a
David McCulloch wrote:
"Mike Foster" <mi********@mfosternospam.com> wrote in message
news:op**************@news.charter.net...
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
;-).

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 McCulloch wrote: (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) + ',' +
Jul 23 '05 #8

P: n/a
"David McCulloch" <|@|.|> wrote in message
news:fI*******************@twister.rdc-kc.rr.com...

"Dag Sunde" <ds@orion.no-way> wrote in message
news:lT*****************@juliett.dax.net...
"David McCulloch" <|@|.|> wrote in message
news:Vd******************@twister.rdc-kc.rr.com...
<snipped/>
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.


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...

--
Dag
5826'15.9" N 00846'45.5" E
Jul 23 '05 #9

P: n/a
"David McCulloch" <|@|.|> writes:
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
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #10

P: n/a

"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
news:wu**********@hotpop.com...
"David McCulloch" <|@|.|> writes:
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.


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.
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.


Why would I be able to OPEN the window and not be able to RESIZE it?
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.


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
Jul 23 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.