scottjehl/iOS-Orientationchange-Fix — Issue #10: IE < 9 complains about addEventListener
Author: adammessinger
Created: 2012-01-12 18:33:40+00:00
State: open

IE < 9 throws a JS error since it doesn't support this method. This can be fixed -- and the script can be exited early on all desktop browsers -- by changing line 8 from this:

```javascript
if( !doc.querySelector ){ return; }
```

to this:

```javascript
if( !doc.querySelector || w.orientation === undefined ){ return; }
```

Another approach would be to use UA sniffing, as suggested in issue #4. This is one of those rare cases where I think it might be a better idea than feature detection.