检测Windows Phone的方向 [英] Detecting Orientation of Windows Phone

查看:44
本文介绍了检测Windows Phone的方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JavaScript事件onorientationchange和参数window.orientation检测我网站上的方向变化和方向值.这适用于iPhone和Android.但是Windows Phone不会触发onorientationchange事件,并且window.orientation是未定义的. 如何检测Windows Phone的方向变化?

I'm using the JavaScript event onorientationchange and the parameter window.orientation to detect orientation changes and orientation values on my website. This works well with an iPhone and an Android. But a Windows Phone doesn't fire the onorientationchange event and window.orientation is undefined. How I detect orientation changes of Windows Phones?

谢谢,康拉德

推荐答案

IE9Mobile不支持这些事件.

IE9Mobile doesn't support these events.

如果您的页面显示在(silverlight)应用程序的WebBrowser控件内,则可以检测应用程序级别的方向更改,然后调用页面上的脚本以传递此信息.

If your page is being displayed inside a WebBrowser control within a (silverlight) app then you can detect the orientation change at app level and then invoke scripts on the page to pass this information.

如果仅在浏览器中运行,则无法检测方向变化.

If you're just running in the browser then there is no way to detect orientation changes.

这篇关于检测Windows Phone的方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆