gmadar
gmadar

Reputation: 1904

orientationchange() on windows phone browser

is there a way to capture an orientation change event in Windows phone 7 in the browser?

in Android and iOS there is the onOrientationchange() event - but in Windows mobile IE9 (Windows phone 7) it just don't work...

Upvotes: 2

Views: 3541

Answers (3)

hexalys
hexalys

Reputation: 5257

You could use a window.resize event as suggested by @Assaf, and detect the orientation with window.styleMedia.matchMedium("(orientation: landscape)");

matchMedium, is the non-standard Webkit precursor of HTML5 matchMedia supported in IE9.

Upvotes: 1

Assaf
Assaf

Reputation: 11

if (navigator.userAgent.match(/Windows Phone/i)) { window.onresize = function (event) { ... } }

window.onorientationchange = function () { ... }

Upvotes: 1

Jordan Wallwork
Jordan Wallwork

Reputation: 3114

Unfortunately it doesn't look like you can. You could use some javascript to detect changes to the screen width though to emulate similar behaviour

Upvotes: 1

Related Questions