Safari 10.1.1 is encountering an issue with accessing the window.innerWidth property

I'm currently working with a script that dynamically changes the font size based on the viewport size.

It seems to be functioning properly in most browsers, except for Safari (I've only tested on version 10.1.1).

https://i.sstatic.net/UX3az.jpg

Answer №1

Ensure that you have chosen the option "All" in the upper section of your development tools. If not, only errors will be displayed, resulting in you only seeing undefined.

Answer №2

Instead of using window.innerWidth, try using screen.width

Note: This method may only be effective on desktop if the browser window is always maximized.

I hope this information is helpful!

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

You are unable to assign mutations in Vuex

Dealing with a peculiar problem where "val" and "ok" can be used within "console.log()", but for some reason, state.user cannot be assigned any value. However, state.user does display 'ok' on the website. export const state = () => ({ user: ...

Executing a time-consuming function call within the componentDidMount lifecycle method of a React component

When working with my React component, I utilize the componentDidMount function to pass a string received through props to a processing function. This function then returns another string which is used to update the component's state. import React, { C ...

Tips for dynamically adding an external SVG animation to your website:

When trying to insert an animated SVG using jQuery or plain JavaScript, they appear static in Chrome and Edge, but display correctly in Firefox: $(".loader").prepend("<svg><use xlink:href='/images/icons.svg#loading-ring'></use> ...

What's the best way to adjust the width of the <Input> component in Reactstrap?

How can I adjust the width of an input element in Reactstrap to be smaller? I've attempted to set the bsSize to small without success <InputGroup> <Input type="text" name="searchTxt" value={props.searchText ...

Can whitelist functionality be applied in the browser version of Babel?

While working on a project for my university, I wanted to utilize React. Since installation wasn't allowed, I had to resort to using the browser version of React. Everything was functioning well until I attempted to incorporate JSX into the browser. ...

The stateless components' onClick event that manages a prop within the Component

My concern lies with a stateless component named EmailItem: I aim to assign it a new prop via a function when clicked. <EmailItem key={i} onClick={// the onClick function here} emailData={email} read={false} /> The desire is for the value of the rea ...

Adjusting the layout of a webpage using CSS

I am facing a challenge where I need to adjust the layout of a webpage using CSS for mobile view. Currently, the desktop version has a sidebar floated to the left and a textbox floated to the right. The HTML structure is as follows: <div id="container" ...

A gap only appears in the drop-down navigation when the page is scrolled

After finally completing my first website, I encountered a frustrating issue. When scrolling down the page, a gap appears in the navigation bar, making it impossible to access the dropdown menus. I've been struggling to fix this problem on my own. Any ...

What is the best way to restrict the input year on @mui/x-date-pickers to a certain range?

Is there a way to restrict the input year range when using @mui/x-date-pickers? I want to limit it from 1000 to 2023 instead of being able to enter years like 0000 or 9999. https://i.stack.imgur.com/0p6j3.jpg I have tried adding a mask to InputProps in my ...

JavaScript alert box

I'm fairly new to the world of web development, with knowledge in CSS & HTML and currently learning TypeScript. I'm attempting to create a message icon that opens and closes a notifications bar. Here's where I'm at so far: document.getE ...

Issues encountered with anchor scrolling upon clicking

Hey there, I'm currently working on setting up a contact page that features two forms with a parallax effect. One thing I want to incorporate is an anchor that smoothly scrolls down to the next form when clicked. Despite trying out numerous code snipp ...

Using jquery to perform ajax queries in sequence

After trying multiple versions of code, I've been unable to figure this out. As someone coming from a php background, JavaScript is new to me. Let's say we have an array with three patches: patch1, patch2, patch3. What I want to achieve: Make ...

Unable to invoke function within class using 'this'

I've been working on a class named Scheduler that runs a cron job using the cron module. I've defined a function to calculate the difference in days between two dates, and it works fine when called outside of the cron job iteration. However, if I ...

What is the best way to conceal a lengthy description and create a toggle feature in React JS?

Having an issue with my ReactJS application. It consists of card items with brief descriptions that I want to expand into full details when clicking a button. The goal is to toggle between short and long descriptions, providing users with flexibility in ...

Contrasting Indented HTML versus Inlined HTML

I am currently in the process of updating a client's website and I have encountered issues with HTML rendering. In the original code, all "a" and "img" tags are placed on a single line, resulting in what is known as INLINE IMG: <div id="inside-im ...

Filtering pages using the Wordpress API version 2

Is there anyone who can help with the following: I am currently working on building an app in React and using Postman to filter pages. I have set up a Router that is supposed to filter the pages based on which button is clicked. I have experimented with a ...

Adjust the width of the table to scroll horizontally and size down to fit within the

My webpage is structured with a sidebar and content section, using flex display with the sidebar set to 0.15 flex and the content set to 0.85 flex. I want this page to be full width of the viewport. The issue arises when I try to incorporate a table into ...

What is the best way to implement alphabetical pagination using Material UI Pagination?

I am attempting to display a list of words using MUI pagination, arranged in alphabetical order. Previous format 1,2,3,...,26 Desired format A,B,C,...,Z wordsList: { A: [], B: [], ..., Z: [] } ...

"Enhance your website's loading speed with the Google Page Speed Up

Hi, I've been using the Google PageSpeed Module and have created a .htaccess file to optimize my website (www.anetoi.com). I tried using combine_css to merge my CSS files but it didn't work as expected. I followed Google's instructions but s ...

Seeking a way to display a random div at a 1% rate without generating additional div elements

Searching for an answer to display only one div with a rate of 1/100. Currently, I am utilizing the following JavaScript: var random = Math.floor(Math.random() * $('.item').length); $('.item').hide().eq(random).show(); This method wor ...