And what were you expecting ?

No particular value at all, it was others here who expect certain
values.

You can name me you know, i'm good with being wrong when i am :)


This discussion started because it was pointed out that typeof tests
on host objects and properties were unreliable. That post was prompted
by the test:

 if (typeof window.onorientationchange == "object")

which was put forward as a reliable way to detect if the
orientationchange event was supported. Apparently you now recognise
that it is not a reliable test.


We can't all know everything, that's why those lists exists ... we can debate and point out when others are mistaken.


Not only does the above demonstrate that typeof tests on host objects and properties are unreliable, but also that IE is the one behaving as
you expect and some other "decent" browser is misbehaving.

`typeof anObject.nonExistentProperty` --> "undefined" is ok.

But some browsers return "object" for listener properties that have
not been set. So testing for support of events using typeof tests on
related host object properties is unreliable. I think you are agreeing
with me.


Sure!
As you know, this list is called iphonewebdev, which means that what we you'll find here / ppl will publish could be wrong on desktop browser. The thing is: for iPhone web dev, it works.

The result of http://www.we-are-gurus.com/labs/onorientation-test.html is
Desktop
- Safari : 'undefined'
- Chrome : 'undefined'
- Firefox : 'undefined'
- Internet Explorer : 'undefined'
- Opera : 'undefined'

Smartphones / Tablets
- iOS (2, 3 & 4) : 'number'
- Android : 'number'
- Blackberry OS6 : 'number'
- Palm WebOS : 'undefined'

http://cl.ly/111r25202T3B1d153722
:)


So i guess the best test would be
if (typeof window.orientation == "number") {
        // supported
} else {
        // not supported
}

Toughts?

R.

--
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en.

Reply via email to