Why your site works in Chrome but not Safari — and why Chrome on iPhone is Safari too

First, one surprising fact that will save you an hour. If a friend sees a bug in Chrome on iPhone but you don't see it in Chrome on your laptop — it's still a Safari bug.
On iPhone, almost every browser runs on Safari's engine, WebKit. That's Apple's rule: Chrome, Firefox and others on iOS are their own interface on top of the same engine. An exception exists only in the EU, and most browsers don't use it yet.
So testing "on an iPhone" means testing WebKit. Below are the three causes beginners hit most often, starting with the most common.
Cause 1. Safari doesn't have that function yet
Symptom: the console shows TypeError: ... is not a function or undefined is not an object. Works on a new Mac, fails for some users.
Safari updates together with the operating system. Anyone who hasn't updated iOS is stuck with an old Safari. And AI happily writes code with the newest functions — the ones that landed in Chrome recently.
How to check. Take the function name from the error and look it up on caniuse.com or MDN. Look at the Safari and Safari on iOS rows. If the version listed is newer than the affected user's — found it.
How to fix.
- If the function is available almost everywhere, add a check and a fallback:
if ("share" in navigator) { ... }. - If you can't do without it, add a polyfill as an npm package.
- If the error isn't
is not a functionbutSyntaxError, it's new syntax. Then you need a bundler setting, not a polyfill: in Vite that'sbuild.target.
Cause 2. Safari wiped the user's data after a week
Symptom: "I got logged out," "my settings reset," "my cart is gone." Only for Safari users, and only for those who haven't visited in a while.
It's not a bug — it's Safari's privacy protection, Intelligent Tracking Prevention. If someone uses the browser for 7 days without visiting your site, Safari deletes everything the site wrote from JavaScript. That's localStorage, IndexedDB, and cookies created with document.cookie. Those cookies also live at most 7 days, even if you set a one-year expiry.
How to check. See where the login token or the cart is stored. If you write them with localStorage.setItem or document.cookie — that's it.
How to fix.
- Keep the login in a cookie set by the server with a
Set-Cookieheader, flaggedHttpOnlyandSecure. The one-week limit doesn't apply to those. - Save important data — the cart, drafts, settings — on the server, and keep only a copy in the browser for speed.
- Exception: if the person added your site to their Home Screen, data lives longer.
Cause 3. A date in the "wrong" format
Symptom: Invalid Date or NaN instead of a date, sorting by date is broken. Fine in Chrome.
Usually this code is to blame:
new Date("2026-11-01 10:00:00") // format with a space
The JavaScript standard only requires browsers to understand the strict ISO format. Everything else is up to the browser. Chrome is generous and accepts almost anything. Safari has historically answered with Invalid Date. You can't rely on generosity.
How to check. Find new Date("...") and Date.parse with strings in your code. A space instead of T, dots or slashes — that's a suspect.
How to fix. Turn the string into ISO with the letter T: "2026-11-01T10:00:00". Even better, have the server send an ISO string with a time zone at the end, like Z.
Small things that look like breakage
A separate class isn't console errors but "the layout slipped only on iPhone." We have breakdowns of the most common ones:
- full-screen 100vh spills past the edge;
- an input zooms the whole page;
- content slides under the notch — then read about the safe area.
How to test Safari without a Mac
You don't need a Mac to catch most of these bugs. Playwright can run the WebKit engine on Windows and Linux:
pnpm dlx playwright install webkit
pnpm dlx playwright open -b webkit https://your-site.com
A window opens on the same engine as Safari, with a console. It's not a perfect copy of an iPhone, but it catches causes 1 and 3. For a real iPhone, you'll need a friend with a phone or a cloud service with real devices.
Why does Apple do this?
A single engine on iOS is an App Store rule. Deleting data protects against tracking by ad scripts, which also store markers in localStorage. Honest sites get caught in the crossfire.
How do I see the Safari console on iPhone?
You need a Mac: turn on "Web Inspector" in Safari settings on the iPhone, connect it with a cable, and open the Develop menu in Safari on the Mac. Without a Mac, use WebKit via Playwright as shown above.
Short story-lessons, an agent simulator and daily practice — in our mobile app. Free.





