Is there a way to determine browser size?

Is there a way to determine browser size? If I have a WE app that requires the width to be at least 300px wide and at least 325px height, and any browser than is smaller than that (either width and/or height) I want to show an “error” page stating the browser is too small. Otherwise I want to show the WE app.

I know I can put in a min width/height for the page, but that doesnt mean it is all on the screen at once.

thanks
sb

I have a little project I that displays the browser size.

One way to handle this is to make an empty startup page with a min size of 32x32 and then check the size when that page loads. Then you can redirect to your app or error page from there.

Greg, how do I get the size of the page when it loads? that is the piece I am missing.

I am going to check that out, thanks Wayne!

In the shown event, check Self.Width and Self.Height. The trick is that the min size needs to be smaller than the smallest device.

Thank you!!

What i can’t understand is why does it working everywhere (Firefox, Chrome, IE) but not in Safari? (only if you refresh the page…)
I’ Version 7.0.6 (9537.78.2)
Somebody has the same problem?

With Safari Version 7.1 (9537.85.10.12) here this in WebPage.Shown displays the size without any problem, and without the need to refresh :

msgbox str(self.width)+" "+str(self.Height)

Thank you for your replay… I forgot to explain that it works only at the first opening. If you resize the browser window this info:
msgbox str(self.width)+" "+str(self.Height)
will not change in Safari but it changes in Firefox, Chrome and IE

[quote=127479:@Roberto Calvi]Thank you for your replay… I forgot to explain that it works only at the first opening. If you resize the browser window this info:
msgbox str(self.width)+" "+str(self.Height)
will not change in Safari but it changes in Firefox, Chrome and IE[/quote]

Place the code in the Resized event. It works here, I just checked.

I did it: new web project - WebPage1 - Event Handlers - Resized:
msgbox str(self.width)+" "+str(self.Height)
Run

On Safari Version 7.0.6 (9537.78.2)

MsgBox tells the correct dimension

Resize Browser window with mouse (in the right corner)

No MsgBox

On Firefox

MsgBox tells the correct dimension

Resize Browser window with mouse (in the right corner)

MsgBox with new dimensions

[quote=127485:@Roberto Calvi]I did it: new web project - WebPage1 - Event Handlers - Resized:
msgbox str(self.width)+" "+str(self.Height)
Run

On Safari Version 7.0.6 (9537.78.2)

MsgBox tells the correct dimension

Resize Browser window with mouse (in the right corner)

No MsgBox

On Firefox

MsgBox tells the correct dimension

Resize Browser window with mouse (in the right corner)

MsgBox with new dimensions[/quote]

If the resized event does not fire, it could mean Safari 7.06 does not report the new size. I cannot test here unfortunately.

If you place the code in a button Action event, you will be able to measure manually after resizing. If the value is correct, that can allow a workaround with a timer that monitors the size of the window.

Otherwise you could use the onresize Javascript event, such as in :

window.onresize = function() { alert('resized!!'); };

Thank you Michel!
Timer will not work… (gives the old values)
with Javascript is difficult to obtain the values as parameters… (and perhaps gives also the old values)
I Think I’ll wait for new Safari version :wink:

The version I use has been updated by App Store.