Contrasting Viewport on Android in Landscape and Portrait Modes

I've been working on a mobile site and in order to test it, I've set up different emulators for Android and used an iPhone emulator as well. The issue I am facing is that when I call window.innerWidth upon orientation change on the iPhone, the viewport changes to 320 in portrait mode and 480 in landscape mode. However, on Android, the viewport remains the same in both landscape and portrait modes. For instance, in a resolution of 480x800, the viewport is 320 in both landscape and portrait modes. My meta tag for the viewport is:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

Is this behavior correct?

Thanks in advance.

Answer №1

It seems like your viewport meta tag is not included in the posting. Nonetheless, you are correct: The innerWidth/Height values do not adjust based on orientation. To address this issue, using CSS3 media queries would be a good solution. For more information, you can refer to the documentation available here: CLICK

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Guide to inserting an HTML file into an article's content

After downloading an extension from freefrontedit and uploading it to my server in the directory /accordeon, I successfully accessed it by pointing my browser to . However, I am now faced with the challenge of loading the index.html into my Joomla article ...

Tips on minimizing the vertical size of a mat field housing a mat-select dropdown

I need help reducing the height of a mat field that includes a mat-select in Angular v15. The code is directly from the material components documentation, with no alterations. It consists of a default table and default outline formfield. <mat-form-fi ...

Adjusting the sound levels of an HTML audio element using JavaScript

I'm looking to adjust the volume of an <audio> element when a user clicks on an image. HTML: <div id="cloud"> <img name="jsVolumeButton" src="images/cloud.png" width = "140px"/> </div> <audio id="player" src="sounds/rain. ...

Tips for getting jquery toggle to function properly

I am struggling with a simple task involving two divs: <div id="slide_menu"> <div id="tic">MENU</div> </div> My goal is to make div#slide_menu toggle up and down when div#tic is clicked. I have attempted to use slideUp, slideDown, ...

Unable to clear input field after submitting form in AngularJS with Ionic framework

Something strange is happening. Whenever I try to clear the model in the controller, the input field that is bound to the model using ng-model does not get cleared when the form is submitted. Controller angular.module('starter.controllers', []) ...

Event handler assigned to a group of constantly changing elements

Here is my JavaScript code: $(document).ready(function(){ $('#data1').change(function(){ title = $('#title1').val(); url = $('#url1').val(); $.post('library/edit.php',{title:title, url:ur ...

Error occurred while retrieving objects from the database: Unable to convert Value Connection of type java.lang.String to JSONObject

My task involves extracting JSON records from a database. When I make a GET request through the browser, the JSON response I receive has the following structure and contains the expected data [{"name":"OOGOGOGO","address":"OPOPOPOP","gender":"OPOPOPOP","e ...

Problem where ipcMain.handle() fails to send a value back to ipcRenderer.invoke()

After spending 2 days struggling with this problem, scouring the API documentation of Electron.js and various websites, I am turning to you all as my final hope: Here are the 3 files that are causing the issue: main.ts (excerpt): app.whenReady().then(() ...

The issue of try-catch not functioning properly within a recursive function

Goal My objective is to capture the "Failed to load resource" error and display it in an alert window. Problem I am attempting to handle a video that does not exist. The try catch block is not catching the exception. Scenario I am working on playing vide ...

Refresh the location markers on Google Maps API to reflect their current positions

I'm currently in the process of learning how to utilize JavaScript with Rails, and I'm encountering some challenges when it comes to updating my markers based on my current position using AJAX. I suspect that the 'ready page:load' event ...

Tips for indicating which content to display on template literals

Utilizing template literals to showcase some fetched data, I've successfully displayed all the necessary information on the frontend. However, certain content is hidden and meant to be toggleable. Yet, I'm struggling to figure out how to link eac ...

What steps should I take to resolve the problem while in Quirks mode?

My current design includes an element with a width of 200px, along with left and right padding of 100px each. However, I have observed that in IE7, IE8, and Firefox 4, the padding is being added to the total width of the element. On the other hand, in IE ...

The functionality of NSURLConnection fails after two consecutive attempts

Whenever I attempt to download an mp3 file using an address, I encounter an issue. I have implemented a uitoolbarbutton that triggers the downloadandCreatePath function. This function generates a view containing my 'downloadProgressV' and a cance ...

Tips for maintaining interactivity after a page refresh

$(document).ready(function () { $("#2").click(function () { $("#content").load("{% url 'about' %}"); }); $("#3").click(function () { $("#content").load("{% url ...

Utilizing Hyperlinks in jQuery DataTables Cell with Data Pulled from Mysql Table

I have a question that builds upon the one before it: How to display a hyperlink in a cell with jQuery DataTables There is also a Fiddle link provided My current query revolves around implementing hyperlinks when fetching data from a MySQL database table ...

__dirname value not able to be retrieved

Currently, I'm utilizing __dirname to obtain the absolute path to the GraphQL schema: const schema = loadSchemaSync(path.join(__dirname, './graphql/schemas/schema.graphql'), { loaders: [new GraphQLFileLoader()] }); After transitioning the ...

Running a setTimeout function within the context of a jQuery each

My goal is to animate characters one by one, but for some reason the following code isn't functioning as expected: $('.overlay-listing').hover(function(){ var idx = 1; $('.strip-hov span', this).each(function(){ if ...

Consistently obtaining the same outcome in JavaScript, always

Is it possible to resolve this issue? I keep getting a result of less than 18 when trying numbers 1-100, even though the output should be for values under 18. In my HTML code, there is a <p> element with id="result", an input with id=&quo ...

Adjusting Iframe height on mobile devices based on window width changes across various devices

I'm dealing with an issue on my URL shortener website involving iframes. <div class="embed-responsive embed-responsive-16by9"> <iframe class="embed-responsive-item" src="<?=$adurl?>"></iframe> When viewing the websites in ...

Ensure that the following div remains positioned beneath the current one

After reading through this question on Stack Overflow, about creating a responsive table with both vertical and horizontal headers, I came across this particular issue, demonstrated in this codepen example: Currently, the second table appears directly bel ...