Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #14987 > unrolled thread

Cross-browser window resize or open to OUTER size

Started by"Chris Beall" <Chris_Beall@prodigy.net>
First post2012-07-09 22:42 -0400
Last post2012-07-10 11:51 -0400
Articles 3 — 2 participants

Back to article view | Back to comp.lang.javascript


Contents

  Cross-browser window resize or open to OUTER size "Chris Beall" <Chris_Beall@prodigy.net> - 2012-07-09 22:42 -0400
    Re: Cross-browser window resize or open to OUTER size Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-07-10 10:37 +0200
      Re: Cross-browser window resize or open to OUTER size "Chris Beall" <Chris_Beall@prodigy.net> - 2012-07-10 11:51 -0400

#14987 — Cross-browser window resize or open to OUTER size

From"Chris Beall" <Chris_Beall@prodigy.net>
Date2012-07-09 22:42 -0400
SubjectCross-browser window resize or open to OUTER size
Message-ID<op.wg7lthcttnmj2w@chris-bealls-imac.local>
I had built a simple tool to test web pages in various standard window  
sizes.
My standard sizes were based on common display hardware sizes, i.e. window  
maximized situations.
It was just a page that included several lines like:
   <a href="javascript:resizeTo(1280,1024)">1280x1024</a>
each line tailored to a standard window size.
With this page open in one tab, I could select a window size, then look at  
the page being tested in another tab to see how it reacted to that window  
size.
If the browser didn't support tabbing, I would first select the window  
size from my tool page, then enter the URL of the page to be tested.
Worked like a charm.

BUT, resizeTo stopped working (on FireFox, and apparently elsewhere as  
well) because it was deemed dangerous except in very restricted  
circumstances, including mine.  You can't resize someone else's window,  
you have to open your own.

To get around that, I changed to:
   <a href="javascript:var windowObjectReference = window.open('',  
'_blank', 'outerWidth=1280,outerHeight=1024,scrollbars')">1280x1024</a>
which works fine....on FireFox.
But IE doesn't understand outerWidth and outerHeight and neither do  
several other browsers.
They just use height and width.  BUT they apparently interpret it as  
meaning INNER height and width (documentation of the interpretation is  
often sketchy).
For my purposes, I need to set the OUTER height and width to simulate a  
hardware device with those physical limits.

Is there any cross-browser way to open a window with a specified OUTER  
width and height?

Chris Beall

[toc] | [next] | [standalone]


#14991

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2012-07-10 10:37 +0200
Message-ID<6168516.zGrmvEn2Nd@PointedEars.de>
In reply to#14987
Chris Beall wrote:

> I had built a simple tool to test web pages in various standard window
> sizes.
> My standard sizes were based on common display hardware sizes, i.e. window
> maximized situations.
> It was just a page that included several lines like:
>    <a href="javascript:resizeTo(1280,1024)">1280x1024</a>
> each line tailored to a standard window size.
> With this page open in one tab, I could select a window size, then look at
> the page being tested in another tab to see how it reacted to that window
> size.
> If the browser didn't support tabbing, I would first select the window
> size from my tool page, then enter the URL of the page to be tested.
> Worked like a charm.
> 
> BUT, resizeTo stopped working (on FireFox, and apparently elsewhere as
> well) because it was deemed dangerous except in very restricted
> circumstances, including mine.  You can't resize someone else's window,
> you have to open your own.

That is not entirely correct.  There are Preferences to control that 
behavior, and privileges can be obtained by code to do that even though the 
relevant Preference is not set.  Other code implicitly has the privileges.  
See below.

> To get around that, I changed to:
>    <a href="javascript:var windowObjectReference = window.open('',
> '_blank', 'outerWidth=1280,outerHeight=1024,scrollbars')">1280x1024</a>
> which works fine....on FireFox.

You should not be using `javascript:' URIs at all; see the FAQ.

> But IE doesn't understand outerWidth and outerHeight and neither do
> several other browsers.
> They just use height and width.  BUT they apparently interpret it as
> meaning INNER height and width (documentation of the interpretation is
> often sketchy).

I find the (cross-browser) documentation at MDN rather enlightening:

<https://developer.mozilla.org/en/DOM/window.open>

> For my purposes, I need to set the OUTER height and width to simulate a
> hardware device with those physical limits.

But the outer height and width rarely counts, since very few people would 
have a browser window in full-screen mode.

> Is there any cross-browser way to open a window with a specified OUTER
> width and height?

Use <http://chrispederick.com/work/web-developer/> instead.


PointedEars
-- 
    realism:    HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness:    XHTML 1.1 as application/xhtml+xml
                                                    -- Bjoern Hoehrmann

[toc] | [prev] | [next] | [standalone]


#14998

From"Chris Beall" <Chris_Beall@prodigy.net>
Date2012-07-10 11:51 -0400
Message-ID<op.wg8mb6a8tnmj2w@chris-bealls-imac.local>
In reply to#14991
On Tue, 10 Jul 2012 04:37:15 -0400, Thomas 'PointedEars' Lahn  
<PointedEars@web.de> wrote:

> Chris Beall wrote:
>
>> I had built a simple tool to test web pages in various standard window
>> sizes.
>> My standard sizes were based on common display hardware sizes, i.e.  
>> window
>> maximized situations.
>> It was just a page that included several lines like:
>>    <a href="javascript:resizeTo(1280,1024)">1280x1024</a>
>> each line tailored to a standard window size.
>> With this page open in one tab, I could select a window size, then look  
>> at
>> the page being tested in another tab to see how it reacted to that  
>> window
>> size.
>> If the browser didn't support tabbing, I would first select the window
>> size from my tool page, then enter the URL of the page to be tested.
>> Worked like a charm.
>>
>> BUT, resizeTo stopped working (on FireFox, and apparently elsewhere as
>> well) because it was deemed dangerous except in very restricted
>> circumstances, including mine.  You can't resize someone else's window,
>> you have to open your own.
>
> That is not entirely correct.  There are Preferences to control that
> behavior, and privileges can be obtained by code to do that even though  
> the
> relevant Preference is not set.
My tool was intended to be used not only on my own system, but also when  
demoing tradeoffs to a client (using 'client' loosely, as all of my work  
to date has been pro bono...).  I do not want to alter client Preferences  
and then have to remember to restore them, working across multiple browser  
types.  I just want to be able to go to a web page, set the window size  
and show the client what the result is.  I don't expect to always get what  
I want, but that is what led to my technical question in the last line of  
the original post.
On Gekko browsers, the Preference settings do not provide the authority to  
use resizeTo.  See <https://bugzilla.mozilla.org/show_bug.cgi?id=565541>  
for extensive history.

> Other code implicitly has the privileges.
> See below.
Aside from the fact that windows opened by a page can be resized by the  
page that opened it, I don't see anything below that applies.  What did I  
miss?
>
>> To get around that, I changed to:
>>    <a href="javascript:var windowObjectReference = window.open('',
>> '_blank', 'outerWidth=1280,outerHeight=1024,scrollbars')">1280x1024</a>
>> which works fine....on FireFox.
>
> You should not be using `javascript:' URIs at all; see the FAQ.
FAQ 13.6 suggests using onclick= to drive the action and I can change to  
do that, though I don't believe any of the caveats apply to my situation.   
This will not, however, resolve the underlying issue.
>
>> But IE doesn't understand outerWidth and outerHeight and neither do
>> several other browsers.
>> They just use height and width.  BUT they apparently interpret it as
>> meaning INNER height and width (documentation of the interpretation is
>> often sketchy).
>
> I find the (cross-browser) documentation at MDN rather enlightening:
> <https://developer.mozilla.org/en/DOM/window.open>
I had read this before posting and it is, indeed, informative.  But it  
simply helped me to state the problem: width alone generally means  
innerWidth, while outerWidth is specific to Mozilla.
>
>> For my purposes, I need to set the OUTER height and width to simulate a
>> hardware device with those physical limits.
>
> But the outer height and width rarely counts, since very few people would
> have a browser window in full-screen mode.
Few developers, perhaps, as many have large displays.  Out in the real  
world, there are still many 1024x768 displays in use and on those the  
users generally run with the browser in full-screen mode.  That's exactly  
why I want clients to see what those users will experience.
>
>> Is there any cross-browser way to open a window with a specified OUTER
>> width and height?
>
> Use <http://chrispederick.com/work/web-developer/> instead.
I am reluctant to install extensions onto a client system and Pederick's  
extensions apply only to Firefox and Chrome.  Most of the client systems  
use IE (and yes, I do try to educate the client in that regard).

I reluctantly conclude that you do not know of any way to do what I  
requested.
>
>
> PointedEars

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web