PDA

View Full Version : Detect current window size



Membie
May 1st, 2003, 06:30 PM
I want to limit resize window options to a minimum size (say 500, 500). If a window is resized less than minimum it should aut. be resized to my minimum settings (same position if possible aswell).

Larger resizing should still be possible as normal.

Can this be done and if so: how? T.i.a.

brothercake
May 1st, 2003, 07:45 PM
The window is mine, not yours. It's under my control, not the control of a website.

I can say that with authority because I use a browser which prevents javascript from opening, closing, moving, resizing or otherwise modifying my windows. But most people don't - and those people will be at best confused, and at worst incredibly annoyed, by any attempt to restrict the size their window is "allowed" to be.

You don't need to do it anyway - I'm willing to bet you want this in order to prevent your design being squished ..?

Membie
May 1st, 2003, 10:26 PM
Pfff.... :D

You're right. No mistake about that. ;)

However... The question wasn't / isn't moral related, your answer is.

For what it matters: in my believe youíve just lost your bet as well.

Some are confused / annoyed by whatever things that can be done by JS where others are not / may even love it. Some may hate / love the chosen subject, colors, fonts (+/-size) or images as well. Impossible to please everyone. The ' + owner _designer _publisher + ' draws the line / decides what and how it comes on Ďmarketí in a way he/she wants it to be (if it can be done in Ďhisí way that is). Hell hť... it is his 'product'.

You gave me a fair warning... nothing wrong with that and I even thank you for that, but, if you donít mind me saying, itís not really an answer to my question as 'impossible' would be. :D
Call it arrogance or whatever... if you donít like it, it wasnít / will not be made for 'you' (plenty of choice elsewhere)... if / when it can be done, that is... I (still) hope.

Exploring the internet is a precious given freedom. In what (design-)way to publish things on the internet should be just that as well i.m.h.p.o.v. Walk on if you donít like it / donít want to / cannot / are not tempted to help me with the answer to my question. ;)

Never mind a discussion though... :D and never a doubt in my mind about your / anybodyís good intentions. ;)

beetle
May 1st, 2003, 11:04 PM
I'll give you hints

window.onresize = function() { }

window.resizeTo( x, y );

document.body.offsetWidth;
document.body.offsetHeight;

Membie
May 1st, 2003, 11:52 PM
Thank you Beetle ;)



<html>
<head>
<SCRIPT language=JavaScript><!--

function minimum_size() {
var height= document.body.offsetHeight;
var width= document.body.offsetWidth;


if (height<250 || width<250)
{

window.resizeTo(250,250);

}
else if (height>250 || width>250)
{
window.resize;
}
}

//-->
</SCRIPT>
</head>
<body onResize="minimum_size()">
This is a test<br>
........................<br>
........................<br>
........................<br>
........................<br>
........................<br>
........................<br>
........................<br>
</body>
</html>

How am I doing? :D

brothercake
May 2nd, 2003, 01:38 AM
I never tell people they're wrong, and today won't be any exception ;)

Within the apparent confines of a browser window, you can do what you want, with as much or as little regard for norms, conventions, expectations as you like. The document is your playground, as it were.

But the window is not on the internet. The window is my computer, and it has nothing to do with you. :)

Arctic Fox
May 2nd, 2003, 01:49 AM
Originally posted by Membie
Some are confused / annoyed by whatever things that can be done by JS where others are not / may even love it. Some may hate / love the chosen subject, colors, fonts (+/-size) or images as well. Impossible to please everyone. The ' + owner _designer _publisher + ' draws the line / decides what and how it comes on Ďmarketí in a way he/she wants it to be (if it can be done in Ďhisí way that is). Hell hť... it is his 'product'.

You gave me a fair warning... nothing wrong with that and I even thank you for that, but, if you donít mind me saying, itís not really an answer to my question as 'impossible' would be.
Call it arrogance or whatever... if you donít like it, it wasnít / will not be made for 'you' (plenty of choice elsewhere)... if / when it can be done, that is... I (still) hope.

Exploring the internet is a precious given freedom. In what (design-)way to publish things on the internet should be just that as well i.m.h.p.o.v. Walk on if you donít like it / donít want to / cannot / are not tempted to help me with the answer to my question.


Wow!

If that isn't a perfect reply, I don't know what would be! :D Those are my EXACT same feelings on how I present/code a site - don't like it... sorry, please move along.

(we should form a group;) )
:thumbsup: :thumbsup:

liorean
May 2nd, 2003, 02:30 AM
Oh, that's not what the disagreement that Brothercake mentioned is about at all...

What is the site?
1. A site is composed of pages.
2. Those pages are there for one of two functions, either they convey data, or functionality.
3. Data is the realm of a document.
4. A document is a way to present data - in other words, it's presentation and content.
5. Functionality, then? Well, functionality is interaction with the user. In other words, reacting on events.
6. So, the realm of the site is Content, Presentation and Events.

Now, what is the interface?
1. The interface is the way a user communicates with the client
2. The client in turn is used to convey the content and presentation of the document to the user.
3. It also provides a way for the user to interact with the document, to produce events.
4. IN othe words, It's the user's way to take part of and interact with the document.

What is the controlling instance of the interface and the site?
1. The site is clearly controlled by the document.
2. The interface is clearly controlled by the user.



What Brothercake here objects to, and I second to, is the act of crossing the boundaries from document to window - the site and the interface. The window and all other parts of the interface belongs to the user and the user alone. The document on the other hand belongs to the site and that is your realm to play within.

That's why you shouldn't resize windows. That's why you shouldn't open new windows. (At least not without telling the user so/asking him if he wants to do so.) That's also the reason you should not play with the user interface parts, such as colouring scrollbars for instance. Those are the user's way of interacting with the document. You should concentrate on answering to the interaction, and providing content and presentation.



HTML and XHTML are document formats. XML can be used as anything. The DOM is supposed to handle documents. CSS is supposed to provide presentation of documents.

In short, those aren't interface features, interface languages. They are document languages, document-centered features. If you want interface control, chose a medium made for that purpose.

Arctic Fox
May 2nd, 2003, 03:42 AM
Okay... my example. :D

Typing paper is used to present text information only...

One's kids can also use it for colouring (art)...

One may also fold it into an airplane and fly it around a stadium...

It can also be a type of weapon (papercuts are the worst)...

OR... close one's mind... and it's still just typing paper. :(


Maybe it's just me - been watching too many Matrix movies - "Free Your Mind" is the phrase I strive to create in every one of my sites. To show others something above/beyond the normal looking site. Yes, information and content is great - but that's not why I'm here on the net. I see my sites as 1) MINE, 2) ART. If I was presenting important information (laws, rules, constitutions) for others, then I would use only the basic ways of having it on the web. But I'm uploading my "art". Hoping to expand one's imagination in the way of web design...

:thumbsup:

Membie
May 2nd, 2003, 10:35 AM
Liorean said:
That's why you shouldn't resize windows. That's why you shouldn't open new windows. (At least not without telling the user so/asking him if he wants to do so.) That's also the reason you should not play with the user interface parts, such as colouring scrollbars for instance. Those are the user's way of interacting with the document. You should concentrate on answering to the interaction, and providing content and presentation.
Everyone is right and entitled to his own opinion (please don't get me wrong), but since you're such a moral preacher man / if that's your opinion: how come your personal homepageÖ (http://liorean.web-graphics.com/) uses a popup with modified window- features (GraphicsInfo section) without telling me a popup will open onClick?
@ Brothercake: speak with authority as much as you like / want, but you're not very consequent either. Your personal homepageÖ (http://www.brothercake.com/) has colored / modified scrollbars (in the default preference). And tell me: isn't disabling the image toolbar (IE 6) in fact user window manipulation as well?
How about this part in your code:
<script>
//window.resizeTo(800,600);
//window.resizeTo(800,685);
</script>
No doubt you (have) use(d) it just to test things. :) Just meant as a laughing reference / to tease you (challenge if you wish) a little

Not need to feel insulted / to get defensive. ;) I just wanted to clear my point (and of Artic Fox: hťÖ we're a team now. LOL :D ) that everyone draws the line somewhere ells (within given possibilities / knowledge / creativity).
My earlier document example was just meant to 'draw' a parallel, to ask you where you / yourself draw the line. At least now I know. ;) :)

liorean
May 2nd, 2003, 12:59 PM
Originally posted by Membie
Everyone is right and entitled to his own opinion (please don't get me wrong), but since you're such a moral preacher man / if that's your opinion: how come your personal homepage� (http://liorean.web-graphics.com/) uses a popup with modified window- features (GraphicsInfo section) without telling me a popup will open onClick?

Why? I think I've had this discussion before... <http://www.codingforums.com/showthread.php?s=&threadid=17710>

First of all, the page opens no popups on itself. The links you have there are titled "bookmarklets" which tells the user one thing: those are to be dragged to their personal toolbar or bookmarked, and then used as tools on other documents. There are bookmarklets of three different models - those that provide a functionality, those that modify a document when it comes to either presentation or content, and those that gather information from a document for display. It's common practice that a bookmarklet that gathers information opens a new window to present that information, and the user knows this. (Note that those are web developer tools, all four.) In short, they aren't really links, they are content, and the user is informed of the behavior through the tagging of the word bookmarklet to them. (java&#0115;cript: links shouldn't be used unless they can be considered to be content)


Well, enough of explaining my standpoint. I'm not here to preach the gospel, whatever it sounds like. I was just pointing out that a web page is a document, not an application. Applications provide the interface and controls to the user, but a document doesn't. That's the whole deal - and the fact that you shouldn't try to make a document behave as were it an application - documents doesn't exist for that purpose. (Aaark - now I did that AGAIN - where is this world coming to?)

Membie
May 2nd, 2003, 04:19 PM
Originally posted by liorean
Why? I think I've had this discussion before...
And you will be having these kind of discussions over and over again as long as you keep 'gospeling' (lol) it is a generall 'thing' to do... instead of referring to these kind of things as "your personal opinion".

We will never ever ever reach an agreement on this one. Just 2 different opinions... no more, no less!! ;)

Quote: "It's common practice..." ---> Just how do you think it became that way? And it most certainly wasn't for me (Yeah.., I know: the site wasn't made for (just) me / all of us, was it?)

Nuff said. ;) :)

Spudhead
May 2nd, 2003, 06:37 PM
I'm gonna sit on my fence on this one, but this:


I was just pointing out that a web page is a document, not an application.

... isn't entirely accurate. Web-based applications development is a big area, and while I agree that control of interface features is taken a little over-zealously in some cases, it can be necessary and it can be managed correctly. If web pages were documents, my job would be a lot simpler, and considerably less well-paid.

brothercake
May 2nd, 2003, 06:38 PM
Originally posted by Arctic Fox
But I'm uploading my "art". Hoping to expand one's imagination in the way of web design...
So you think that crossing the boundary between document and window can be considered art - would you consider that removing the ramps from a building so that it's impossible for people in wheelchairs to enter can be considered art? Well it's the same thing.

I will hold up my hands up and admit that my own site contradicts what I now preach in small ways (like the coloured scrollbar). That's because I made that site more than a year ago, when I didn't know what I know now, and I haven't yet had time to update it. I can honestly say that everything I do now is true to what I'm saying.

Originally posted by Membie
We will never ever ever reach an agreement on this one. Just 2 different opinions... no more, no less!! ;)
This argument is going to be resolved, and quite soon. Window control is being gradually removed from web standards; options to prevent window control is being added to web browsers. I anticipate that, within a few years and for all practical purposes, document scripting languages (like javascript) will not be able to manipulate windows at all.

beetle
May 2nd, 2003, 07:03 PM
Originally posted by brothercake
Window control is being gradually removed from web standards;Yessiree, like the chromeless bug fix in IE6 SP1

Membie
May 2nd, 2003, 07:34 PM
Originally posted by beetle
Yessiree, like the chromeless bug fix in IE6 SP1
Which has a 'workaround'... (http://www.chromeless.org/) http://www.designhulp.nl/SystemImages/icon_smile_tongue.gif :D (let's call it that way or speak Spanish. LOL)

beetle
May 2nd, 2003, 07:52 PM
I know, and that's fine -- those that wish to have it can use the workaround. But that's not the point -- the point is that bcake is right. Window control via scripting is on the way out.

I always thought chromless windows were kitschy anyways.

liorean
May 2nd, 2003, 08:14 PM
Let's try to answer in order:

Membie: It might be that I agree on it, and it's thus a personal opinion as you point out, but it's not a concept I thought out. The concept has originated as discussions among the W3C members, the browsers makers (who happen to be W3C members), the Semantic Web initiative, and a few W3C independent sources. The reason frames are going away and the target attribute is removed from xhtml (strict) is just that. The accessibility guidelines and the various non-W3C usability guidelines are all in line with my "preaching". All browser makers except Microsoft seems to have the same basic idea - the separation of application and document is becoming clearer. If it wasn't for the fact Netscape added possibilities to modify the interface to JavaScript in the first place, they would never have been introduced today. All in all, I have a firm backing of my opinion here, from the sources that really count.

About the bookmarklets opening in new windows: As bookmarklets displaying information about the current page opening a new window to do so, it could often be done by modifying the document - but then you wouldn't have the same source of the information. As long as you want to have the source for the information intact, you must display the information about it outside it. Because it's easier that way, it's become general practice to open new windows instead of modifying the document even when modyfying the document wouldn't be an issue.



Spudhead: First of all, you're halfway right. They are much more complex environments than a web site usually is. You often use proprietary features and specialise in one or a few target browsers, and all user interface control given a web document today are proprietary (albeit some are de facto standards, such as DOM0 and a few methods of the window object). Then you have the different ways of asking for more interface control in moz and ie, or producing special high-control environments like hta and xul documents. These are still documents, but they are documents describing the interface. Also, though lots of the web application features lie on the client side, the functionality is more often than not server-side. A plug in or activex component such as java, flash, shockwave, euphoria has much stronger interface control abilities than a web (html/css/javascript/dom) site/page has clientside, and far more stable serverside abilities. Also, specialised xml components are more usual here.
On the other hand you are correct - the current web applications have a pretty solid set of controls over how their interface looks.

There exists no standard cross-browser cross-platform web based application language/set of technologies yet, but if the W3C ever got to that (before Microsoft, Mozilla and Apple have reached too far in their own technologies), I think we would get a pretty fast division into application-specific and document-specific technologies.


Brothercake, or beetle or just anyone: With more and more people using WebWasher (or similar applications) in ie to get rid of *bad* JavaScript, moz with a lot of the *bad* javascript toggled off, or op7 with similar efforts, I'd say it's pretty hard to rely on these features even today. Especially since I know of at least one ISP here in town that filters out all javascript from pages containing the string "open(" inside script tags - as a service to it's users. (The proxy is optional. They also filter out spam mail and web ads if you want.) They aren't the last ISP to provide those convenience features, I'd say.

beetle
May 2nd, 2003, 08:29 PM
filters out all javascript from pages containing the string "open(" inside script tags - as a service to it's users.Interesting. I see a workaround for that already.

liorean
May 2nd, 2003, 08:41 PM
Oh yes, there are several such, but most aren't taking into count something that maybe 15 000 people at highest use. WebWasher (which acts as a local proxy) does the same thing in a bit more refined way. You can't do window['open']() in it, but have to use window['op'+'en']() or store 'open' in a string variable. But in short, it's easy to get around.

Still, it stops almost all the sites containing popups.

beetle
May 2nd, 2003, 08:50 PM
I finds

window['open']()

too? Well, there's always

window.opn = window.open;
window.opn();

brothercake
May 2nd, 2003, 09:05 PM
This is exactly true, and more so - there has never been a time when controlling the window environment is reliable - all that's really changed is the reason, from lack of javascript support (in legacy browsers) to lack of javascript permission (in modern js preferences).

That ByKlein chromeless thing has utterly utterly missed the point of why chromeless windows aren't allowed -

For goodness sake - if you want to make an ultra-cool Flash piece in an entirely customised interface, that's great - you go for it - but javascript is not the language to use for building the interface - there are host languages like C++; there are pseudo-application languages like HTA and XUL like liorean mentioned; those are the languages for building interfaces.

Graeme Hackston
May 3rd, 2003, 07:00 PM
My 2 cents on this issue.

The most compelling argument I've heard for not altering the browser is the impact it has on the user. If any part of the window is altered when a user opens a page, the users focus will be on the container and not the content.

As an example lets say your surfing with IE and open a page with coloured scrollbars. What is the first thing that grabs your attention? Is it the great picture of the widget the page is trying to sell or is it the altered scrollbars? Personally the first thing I'd notice is the scrollbars.

If a designer wants to get maximum impact from his/her page, any changes to the window can only decrease that impact.