I am using 3.2 and 4.0 iOs and I am trying to run html file in UIWebView. the开发者_如何学C html file contains to following lines:
var pwint = function(text) {
var output = document.getElementById('output');
output.innerHTML = output.innerHTML + text + '\n';
};
var reorient = function(e) {
pwint('Window Orientation: ' + window.orientation);
};
window.onorientationchange = reorient
The problem is that window.orientation
always returns '0' while I run the same code in safari it works as expected.
any ideas?
Try applying it to document.body.onorientationchange
.
精彩评论