Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7030453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:40:21+00:00 2026-05-28T00:40:21+00:00

So I’m sure you’re familiar with a little issue that ipad has when rotating.

  • 0

So I’m sure you’re familiar with a little issue that ipad has when rotating. When a user rotates the ipad wants to keep the initial scale and ends up zooming in when it rerenders.

A lot of people have suggested remedying it with this

<meta name="viewport" content="width=device-width, maximum-scale=1.0, initial-scale=1.0"/>

which works great except it doesn’t allow the user to zoom in and out of the website anymore. I’m curious if there is a way to detect the orientation change swap the viewport information and then reset.

For example

on load my viewport would be

<meta name="viewport" id="view-port" content="width=device-width, initial-scale=1.0"/>

then theoretically have some js that does something like this:

  window.onorientationchange = function() {
    $("#view-port").attr("content", "width=device-width, maximum-scale = 1.0, initial-    scale= 1.0");
    setTimeout("resetMetaTag()", 500);
 };

  var resetMetaTag = function() {
    $("#view-port").attr("content", "width=device-width, initial-scale= 1.0");
    console.log($("#view-port").attr("content"));
  };

This doesn’t work because rather than swapping viewports before the orientation is made it does it asynchronously. Is there a way to detect a sort of “about to rotate” or to just interject a function prior to the screen being rerendered?

that would help a lot.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:40:22+00:00Added an answer on May 28, 2026 at 12:40 am

    Couple answers here, to allow the user to zoom in and out add user-scalable=1 to the viewport properties and remove maximum-scale=1.0, or change it to a higher value. maximum-scale=1.0 means exactly that, the user will not be able to scale the screen any greater than its current level:

    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=1;" />
    

    If you want to detect orientation change, attach an event listener to the window:

    window.addEventListener('orientationchange', updateOrientation, false);
    

    In the updateOrientation function you can detect which orientation the device is in and reset the viewport attributes accordingly:

    function updateOrientation() {
      if (!(navigator.userAgent.match(/iPhone/i)) && !(navigator.userAgent.match(/iPod/i))) {
        return;
      }
    
      var viewport = document.querySelector("meta[name=viewport]");
    
      switch (window.orientation) {
        case 0: //portrait
          //set the viewport attributes to whatever you want!
          viewport.setAttribute('content', 'width=device-width, initial-scale=1.0, user-scalable=1;');
          break;
        case 90: case -90: //landscape
          viewport.setAttribute('content', 'width=device-width, initial-scale=1.0, user-scalable=1;');
          break;
        default:
          viewport.setAttribute('content', 'width=device-width, initial-scale=1.0, user-scalable=1;');
          break;
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters
I am doing a simple coin flipping experiment for class that involves flipping a
I have an array which has BIG numbers and small numbers in it. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.