Started off supporting Chrome, but realized that Safari was 40% of my traffic.... and now pulling my hair out, trying to support both... How do you guys deal with this?

How do you guys deal with this?

There is not really enough info to fully answer your question. I have no clue what you’re building or how (besides “if (isIOS)…”). But that kind of code smacks of how we used to develop web apps in 2005. We generally use libraries and/or frameworks that take into account the subtle browser differences.

My suggestion, don’t relearn the lessons of the last 20 years of web development. Try your hardest to avoid browser-specific code. If you must, wrap it in some kind of abstraction and centralize it. Avoid sprinkling browser-specific code throughout your app. Dig a little deeper into the docs of the library/framework you’re using. Or, if you aren’t using one, do so.

@Gracen
Ah! I think that kind of answers my question right there…

Rather than try to build it from plain JS… I should have used a modern framework like React, which has already worked out those kinks!

Lesson learned.

http://postbaby.com <— this is the app I’m working on, btw.
self-hosted version repo: https://github.com/markrai/postbaby

@Reilly
postbaby.com says the domain’s for sale for $4500.

@Reilly
You can always architect your own basic framework if you want to. The important bit of their advice is using abstraction and centralizing all the workarounds in such a way they stay in one easy to manage spot.

I imagine you’re running into issues based on events in JS. There are more than a handful of event systems that handle cross-browser and mobile/desktop. I suggest you swap out your event handling to one of them. Beyond that, using plain JS across different browsers and devices is pretty much the same.

I will just say that I feel your pain.

Having built navigation menus that utilize focused elements to hide/show submenus, I was a bit traumatized with how differently Safari manages focus state.

With regard to how I deal with cross-browser compatibility in general, I try to use best practices and approaches that work across browsers. It’s annoying when there is a difference (like focus state management), but most modern browsers are largely compatible nowadays. As one example, I mostly don’t worry about portrait/landscape/device, as responsive design makes it relatively straightforward to create a layout that works across most every device. And whenever possible, I do things with CSS rather than with JavaScript (it is super rare that I need to do some sort of device/viewport detection with JavaScript).

I later realized that even “Chrome” on iOS devices, pretty much “acts” just like Safari

It, quite literally, is Safari on iPhone. Foreign browser stacks are completely disallowed from running on the iPhone. Even Firefox is a WebKit build.

@Hadi
Mostly, but it is possible that the engine is different if the device is in/registered in the EU - Using alternative browser engines in the European Union - Support - Apple Developer

Just you know, to add more complications :slight_smile:

People who keep saying Safari is the new explorer must have missed that era

Safari is SO much more capable than explorer was compared to chrome – there is a much smaller gap.

What kinds of issues are you running into? Cookie issues are not unique to Safari as the iOS devices block third-party cookies.

@Jesse

Safari is SO much more capable than explorer was compared to chrome–there is a much smaller gap.

Most people aren’t saying it’s “as bad as IE was”. That’s such a hard bar to clear. It’s just saying “Safari is the new IE” in that it’s analogous to having 1 browser being way behind all other browsers to the point you need to get hacky with specific fixes just for that one browser and you have to do it because so much of your traffic is coming from them, much like how IE was back in the day.

You are correct that Safari is no where near as bad as IE was back then. But you’ll be hard-pressed to argue that it doesn’t bring back very similar vibes. I did plenty of IE hacks, polyfills and what not 15 years ago, and working with Safari now brings back similar feelings, but just less frustrating, usually.

@Jesse
IE was not a problem because it wasn’t capable. It was much more capable than everything else at the time, not to mention it was way ahead of its time in many areas.

Its problem was that it didn’t follow standards - in many cases because it was a pioneer and already had something that did the same thing, but with a different name.

@Jesse
I’m saying that Safari is the new IE and I was coding back when IE 6 was the standard.

It is capable, but Apple is purposely locking features that are widely used in other browsers. Of course the analogy is not 1:1 the same, as we live in different times now, but it’s 2025th and we have a browser that holds back the whole web development efforts. It’s not that Apple can’t develop these features, it’s that they don’t want to. And I’m writing this from a Mac with an iPhone and AirPods.

Bennie said:
@Jesse
[deleted]

or “php sucks”

while Laravel exists

@Jesse
I have not missed that Era; I survived it lol.

Safari is 90% of our browser-specific bugs on our design system now; updates break stuff and they tend to stick to their own standards instead of the consortium.

@Jesse
The current issues are related to touch-events, such as long-presses and text-boxes, where Apple apparently has some restrictions on bringing the focus to a textbox programmatically due to “security reasons.”

The workarounds end up giving a sour UX experience… for both Android, as well as iOS…

As someone else had noted… I should have used a modern framework.

Safari is the new Internet Explorer.

Luckily, there aren’t … TOO many “gotchas”, but the ones that you’ll stumble across can indeed be infuriating.

How do we deal with it? Fock, we just deal with it. You have to support Safari, as you’ve discovered. So you jump through the hoops. Best of luck buddy, sorry I don’t have any better advice.

You just deal with it.

I read that you are a Java developer, then you know about classes; use a JavaScript class for each browser to avoid sprinkling if cases everywhere. Now you only need one if case on page load to pick the correct class based on what browser.

Either you use inheritance to share common functionality and override methods when needed and/or class methods can call into a common reusable library or do some custom code.

@Emory
Ah! Yes, I did make the rookie mistake of dumping everything in a main JS file, and only having a few other utility functions in another file.

Add to all your woes users who swear up and down that Safari and Apple are doing it right and you are wrong for daring to go against their design philosophy.