开发者

window.orientation is not working in UIWebView

开发者 https://www.devze.com 2023-01-22 14:36 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消