How do I detect the device orientation inside an iFrame?

0 favourites
  • 1 posts
From the Asset Store
94 Inside buildings views - Isometric view - PNG transparent - 2048x2048
  • 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:

    Cnds.prototype.IsPortraitLandscape = function (p)
    {
    	var current = (window.innerWidth <= window.innerHeight ? 0 : 1);
    	return current === p;
    };
    [/code:3ggzgtpe]
    
    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?
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)