473,416 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

window.open / resizeTo problem

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
10 6694
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

"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
"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
58°26'15.9" N 008°46'45.5" E
Jul 23 '05 #4
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

"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

"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
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
"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
58°26'15.9" N 008°46'45.5" E
Jul 23 '05 #9
"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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Carol Lyn | last post by:
Could use your assistance with this. I have a window that opens via onclick and it is a small window with info about a site. If the user is interested in visiting that site, there is a link to...
2
by: Charles Packer | last post by:
From one of the online Javascript tutorials, I learned how to open a new window and set its size. I'm building a page that has several small photographs, and I want to let the viewer examine...
4
by: Andrew Poulos | last post by:
If I use this code to maximise a browser window: window.moveTo(0,0); window.resizeTo(screen.width,screen.height); it works but on Windows the user can have a taskbar visible and the browser...
6
by: David Hayes | last post by:
juglesh <juglesh@nospamRadioKDUG.com> wrote in "Re: how to maximize the browser window that fits the monitor size?" (Saturday, January 01, 2005 3:12 AM): > > >I want to maximize the browser...
2
by: Saeed Sedighian | last post by:
Hello All. I open a window using showModalDialog function. (window.showModalDialog('webform2.htm',null,'resizable:yes')) In modal window after page loaded i want to change size of window using...
3
by: EnjoyNews | last post by:
I have a popup problem. I have a script that generates a popup for image viewing. It has 2 function, and the first is that it automaticly generates the popup window to the size of the image,...
2
by: Francesco | last post by:
Hi, got a problem, hope someone could help: this function should open a popup showing an image automatically adjusting browser window's height and width. It works fine with IE6 but not with...
9
by: tshad | last post by:
This was posted before but the message got messed up (all NLs were stripped out for some reason). I have 2 labels that hold the name of different images on my .aspx page. <asp:Label ID="Logo"...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.