Option to automatically lock survey in landscape orientation for cell phones? | XM Community
Skip to main content
Question

Option to automatically lock survey in landscape orientation for cell phones?

  • June 23, 2025
  • 2 replies
  • 46 views

Forum|alt.badge.img+2

I have a Qualtrics survey that participants will complete using their cell phones.  Based on the question formatting, I would like the survey to be displayed in LANDSCAPE orientation only.  Is there a way to set up the survey so that it will automatically be locked in landscape orientation (and will not switch to portrait orientation even if users rotate their phones)?

2 replies

rochak_khandelwal
Level 5 ●●●●●
Forum|alt.badge.img+31
  • Level 5 ●●●●●
  • 170 replies
  • June 24, 2025

As fast as I know, there isn’t a native way in Qualtrics to automatically lock the survey in landscape orientation on mobile devices. Most mobile browsers (especially on iOS and Android) don’t allow web pages to force orientation, due to user experience and security policies.

However, a common workaround is to use custom JavaScript to detect the screen orientation and show a message asking the user to rotate their device. Here’s a basic version you can add to your survey (either under Look & Feel → Add Custom JS, or within a question’s JavaScript):
Qualtrics.SurveyEngine.addOnload(function () {
  function checkOrientation() {
    if (window.innerHeight > window.innerWidth) {
      // If in portrait, replace content with prompt
      document.body.innerHTML = "<div style='text-align:center; margin-top:30vh; font-size:1.5em;'>Please rotate your phone to landscape mode to continue.</div>";
    }
  }
  checkOrientation();
  window.addEventListener("resize", checkOrientation);
});

Hope this helps!
-- Rochak


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6084 replies
  • June 24, 2025

@Nadia,

In my opinion, a better way to handle this is with a CSS media rule.  See this.