How do I detect the device orientation inside an iFrame?

Get help using Construct 2

Post » Tue Feb 02, 2016 1:21 pm

I am embedding an HTML5 game that runs in landscape mode into an iFrame. The game has a layer which asks the user to rotate the phone if he/she holds it in portrait mode.

The activitiy "Browser.isPortrait" does not fire, however. I checked in the c2runtime, and it looks like the code is very basic:

Code: Select all
Cnds.prototype.IsPortraitLandscape = function (p)
   var current = (window.innerWidth <= window.innerHeight ? 0 : 1);
   return current === p;

Now, this always returns landscape of course, because the iframe's width is larger than it's height, no matter what the device orientation is. How can I display a message asking the user to turn the device inside an iFrame?
Posts: 4
Reputation: 183

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 64 guests