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

<BODY onBlur="resizeTo(150,150)"> doesn't work in IE6

P: n/a
rob
Hi

I'm trying to create a "roll-up" effect when a window loses focus and then
"roll-down" when it regains focus.

This statement works properly with every browser I can get my hands on EXCEPT
WinIE6. WinIE6 says there's an error in the code, but the debugging info says
the problem is on line 1 char 1, which are comments.

<Body bgcolor='black' Text='#dbdbdb' onblur='window.resizeTo(150,150)'
onfocus='window.resizeTo(150,300)'>

TIA
Rob
www.rcp.ca

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


P: n/a
rob wrote:
Hi

I'm trying to create a "roll-up" effect when a window loses focus and then
"roll-down" when it regains focus.

This statement works properly with every browser I can get my hands on EXCEPT
WinIE6. WinIE6 says there's an error in the code, but the debugging info says
the problem is on line 1 char 1, which are comments.
IE6 SP2 on WinXP doesn't give that error, it gives an access denied
error. But it points to the same place, which is the body tag. Its part
of IE's "great" error messages.
<Body bgcolor='black' Text='#dbdbdb' onblur='window.resizeTo(150,150)'
onfocus='window.resizeTo(150,300)'>


When you say "works properly" with every browser except IE, did you test
that code in Mozilla? It does not work for me there, it does nothing. It
also does nothing in Opera. So where *does* it work for you?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2

P: n/a
rob
In message <H7********************@comcast.com> - Randy Webb
<Hi************@aol.com> writes:
:>
:>rob wrote:
:>
:>> Hi
:>>
:>> I'm trying to create a "roll-up" effect when a window loses focus and then
:>> "roll-down" when it regains focus.
:>>
:>> This statement works properly with every browser I can get my hands on EXCEPT
:>> WinIE6. WinIE6 says there's an error in the code, but the debugging info says
:>> the problem is on line 1 char 1, which are comments.
:>
:>IE6 SP2 on WinXP doesn't give that error, it gives an access denied
:>error. But it points to the same place, which is the body tag. Its part
:>of IE's "great" error messages.
:>
:>> <Body bgcolor='black' Text='#dbdbdb' onblur='window.resizeTo(150,150)'
:>> onfocus='window.resizeTo(150,300)'>
:>
:>When you say "works properly" with every browser except IE, did you test
:>that code in Mozilla? It does not work for me there, it does nothing. It
:>also does nothing in Opera. So where *does* it work for you?
:>
:>--
:>Randy
:>comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly

Hi Randy

Here's the entire test code
-----
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<Html>
<Head>
<Title>blur test</Title>
</Head>
<Body onblur="window.resizeTo(150,150)" onfocus="window.resizeTo(150,300)">

this is a test window

</Body>
</Html>
-----

I've tested this on Mozilla 1.7.5 (on WinXPpro), WinIE5 (on Win98) and
Opera(on WinXPpro). When you click anywhere on the desktop the browser window
shrinks, making it the active window restores it.

With WinIE6(on WinXPpro), the window doesn't change.

I just tried something... If I change onblur to do a "window.close" instead of
a "window.resize", then it works as expected (the window closes) with all of
the above mentioned browsers.

It appears to be related to the "window.resize" routine.
I'll try this same test at work tomorrow with IE6 on WinXP home & Win98
systems and see what happens.

thanks
Rob
www.rcp.ca

Jul 23 '05 #3

P: n/a
In article <11*************@corp.supernews.com>, gr***********@rcp.ca
enlightened us with...

<Body bgcolor='black' Text='#dbdbdb' onblur='window.resizeTo(150,150)'
onfocus='window.resizeTo(150,300)'>


In case you weren't aware, Opera and Mozilla/Firefox have options to prevent
window resizing. Window resizing causes problems in tabbed browsers if I open
the document in a tab when you assumed I was opening it in its own window;
the code ends up resizing ALL my open tabs. Very irritating.
And ALL new windows open in tabs for me and anyone else who sets their
Firefox to do that. Opera may have a similar option.

As to the problem, you may want to change window.resizeTo to self.resizeTo in
the onBlur. That's all I can think of.

--
--
~kaeli~
Those who get too big for their britches will be exposed in
the end.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #4

P: n/a
rob
In message <MP************************@nntp.lucent.com> - kaeli
<ti******@NOSPAM.comcast.net> writes:
:>
:>In article <11*************@corp.supernews.com>, gr***********@rcp.ca
:>enlightened us with...
:>>
:>> <Body bgcolor='black' Text='#dbdbdb' onblur='window.resizeTo(150,150)'
:>> onfocus='window.resizeTo(150,300)'>
:>>
:>
:>In case you weren't aware, Opera and Mozilla/Firefox have options to prevent
:>window resizing. Window resizing causes problems in tabbed browsers if I open
:>the document in a tab when you assumed I was opening it in its own window;
:>the code ends up resizing ALL my open tabs. Very irritating.
:>And ALL new windows open in tabs for me and anyone else who sets their
:>Firefox to do that. Opera may have a similar option.
:>
:>As to the problem, you may want to change window.resizeTo to self.resizeTo in
:>the onBlur. That's all I can think of.
:>
:>--
:>--
:>~kaeli~

Hi

Thanks for letting me know about the tabbed browser problems.

I've been doing some testing on a variety of systems and the only combination
that doesn't resize properly is XP Pro (sp2) with IE6 (sp2). The sp1 levels
work fine as do older versions of Windows & IE. Personally, I prefer Mozilla
anyway.

If I change window.resize to window.close and load it into an sp2 system, then
the window closes as expected. Seems to be something about sp2 that doesn't
like a window.resize being called by an onblur.

Here's my test page....

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<Html>
<Head>
<Title>blur test</Title>
</Head>
<Body onblur="window.resizeTo(150,150)" onfocus="window.resizeTo(150,300)">

this is a test window

</Body>
</Html>

Thanks

Rob
www.rcp.ca

Jul 23 '05 #5

P: n/a
"rob" <gr***********@rcp.ca> wrote in message
news:11*************@corp.supernews.com...
In message <MP************************@nntp.lucent.com> - kaeli
<ti******@NOSPAM.comcast.net> writes:
:>
:>In article <11*************@corp.supernews.com>,
gr***********@rcp.ca
:>enlightened us with...
:>>
:>> <Body bgcolor='black' Text='#dbdbdb'
onblur='window.resizeTo(150,150)'
:>> onfocus='window.resizeTo(150,300)'>
:>>
:>
:>In case you weren't aware, Opera and Mozilla/Firefox have options to
prevent
:>window resizing. Window resizing causes problems in tabbed browsers
if I open
:>the document in a tab when you assumed I was opening it in its own
window;
:>the code ends up resizing ALL my open tabs. Very irritating.
:>And ALL new windows open in tabs for me and anyone else who sets
their
:>Firefox to do that. Opera may have a similar option.
:>
:>As to the problem, you may want to change window.resizeTo to
self.resizeTo in
:>the onBlur. That's all I can think of.

I've been doing some testing on a variety of systems and the only
combination
that doesn't resize properly is XP Pro (sp2) with IE6 (sp2). The sp1
levels
work fine as do older versions of Windows & IE. Personally, I prefer
Mozilla
anyway.

If I change window.resize to window.close and load it into an sp2
system, then
the window closes as expected. Seems to be something about sp2 that
doesn't
like a window.resize being called by an onblur.

Here's my test page....

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<Html>
<Head>
<Title>blur test</Title>
</Head>
<Body onblur="window.resizeTo(150,150)"
onfocus="window.resizeTo(150,300)">

this is a test window

</Body>
</Html>


Yup, you're right, IE 6.0.2900 doesn't allow that, so don't do it.

While this behaviour is not specifically addressed at <url:
http://www.microsoft.com/technet/pro...rows.mspx#ECAA
/>, it's easy enough to see how moving and resizing a window after a
user moved off it could be considered a malicious use of script. You
could mess around with the user such that everytime they moved off a
window, you could resize and move it, so the user wouldn't know where on
their desktop to find the window the next time they wanted to look at it

Consider the following script:

<script type="text/javascript">
window.onblur = function()
{
window.moveTo(
Math.random() * screen.availWidth,
Math.random() * screen.availHeight
);
window.resizeTo(
Math.random() * screen.availWidth,
Math.random() * screen.availHeight
);
}
var t = setInterval('window.blur()', 50);
</script>

The constant window.blur() makes it impossible to bring focus to the
window, and the constant moving and resizing prevents clicking the close
icon.

Quite frankly, you don't get much of a "window roll up" effect anyway,
since the browser continues to show it's toolbar(s), address bar and
status bar.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #6

P: n/a
rob
In message <zy***************@news2.mts.net> - "Grant Wagner"
<gw*****@agricoreunited.com> writes:
:>
:>"rob" <gr***********@rcp.ca> wrote in message
:>news:11*************@corp.supernews.com...
:>> In message <MP************************@nntp.lucent.com> - kaeli
:>> <ti******@NOSPAM.comcast.net> writes:
:>> :>
:>> :>In article <11*************@corp.supernews.com>,
:>> gr***********@rcp.ca
:>> :>enlightened us with...
:>> :>>
:>> :>> <Body bgcolor='black' Text='#dbdbdb'
:>> onblur='window.resizeTo(150,150)'
:>> :>> onfocus='window.resizeTo(150,300)'>
:>> :>>
:>> :>
:>> :>In case you weren't aware, Opera and Mozilla/Firefox have options to
:>> prevent
:>> :>window resizing. Window resizing causes problems in tabbed browsers
:>> if I open
:>> :>the document in a tab when you assumed I was opening it in its own
:>> window;
:>> :>the code ends up resizing ALL my open tabs. Very irritating.
:>> :>And ALL new windows open in tabs for me and anyone else who sets
:>> their
:>> :>Firefox to do that. Opera may have a similar option.
:>> :>
:>> :>As to the problem, you may want to change window.resizeTo to
:>> self.resizeTo in
:>> :>the onBlur. That's all I can think of.
:>>
:>> I've been doing some testing on a variety of systems and the only
:>> combination
:>> that doesn't resize properly is XP Pro (sp2) with IE6 (sp2). The sp1
:>> levels
:>> work fine as do older versions of Windows & IE. Personally, I prefer
:>> Mozilla
:>> anyway.
:>>
:>> If I change window.resize to window.close and load it into an sp2
:>> system, then
:>> the window closes as expected. Seems to be something about sp2 that
:>> doesn't
:>> like a window.resize being called by an onblur.
:>>
:>> Here's my test page....
:>>
:>> <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
:>> <Html>
:>> <Head>
:>> <Title>blur test</Title>
:>> </Head>
:>> <Body onblur="window.resizeTo(150,150)"
:>> onfocus="window.resizeTo(150,300)">
:>>
:>> this is a test window
:>>
:>> </Body>
:>> </Html>
:>
:>Yup, you're right, IE 6.0.2900 doesn't allow that, so don't do it.
:>
:>While this behaviour is not specifically addressed at <url:
:>http://www.microsoft.com/technet/pro...rows.mspx#ECAA
:>/>, it's easy enough to see how moving and resizing a window after a
:>user moved off it could be considered a malicious use of script. You
:>could mess around with the user such that everytime they moved off a
:>window, you could resize and move it, so the user wouldn't know where on
:>their desktop to find the window the next time they wanted to look at it
:>
:>Consider the following script:
:>
:><script type="text/javascript">
:>window.onblur = function()
:>{
:> window.moveTo(
:> Math.random() * screen.availWidth,
:> Math.random() * screen.availHeight
:> );
:> window.resizeTo(
:> Math.random() * screen.availWidth,
:> Math.random() * screen.availHeight
:> );
:>}
:>var t = setInterval('window.blur()', 50);
:></script>
:>
:>The constant window.blur() makes it impossible to bring focus to the
:>window, and the constant moving and resizing prevents clicking the close
:>icon.
:>
:>Quite frankly, you don't get much of a "window roll up" effect anyway,
:>since the browser continues to show it's toolbar(s), address bar and
:>status bar.
:>
:>--
:>Grant Wagner <gw*****@agricoreunited.com>
:>comp.lang.javascript FAQ - http://jibbering.com/faq
:>
:>

Thanks for the info and the link (it made for an interesting read).

I showed some friends what I was trying to do, they went "yuck" and I went
hmmmm-maybe this isn't a good idea after all.

Thanks
Rob
Jul 23 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.