Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work in WKWebView #3575

Closed
Tracked by #783
litherum opened this issue Dec 14, 2021 · 4 comments
Closed
Tracked by #783

Does not work in WKWebView #3575

litherum opened this issue Dec 14, 2021 · 4 comments
Labels
browser/safari Only affects Apple Safari help wanted type/bug Something is misbehaving

Comments

@litherum
Copy link

litherum commented Dec 14, 2021

The check in https://github.com/xtermjs/xterm.js/blob/master/src/common/Platform.ts#L21:

export const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);

doesn't seem to catch WKWebView, which is the browser engine powering Safari. Safari's user agent string (on an iPad) is:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Safari/605.1.15

Whereas WKWebView's user agent string (on an iPad) is:

Mozilla/5.0 (iPad; CPU OS 15_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148

This is causing the demo on https://xtermjs.org to not show any content in WKWebView.

@Tyriar
Copy link
Member

Tyriar commented Dec 14, 2021

@litherum do you know of an easy way to test a wkwebview on a macbook?

@Tyriar Tyriar added browser/safari Only affects Apple Safari type/bug Something is misbehaving labels Dec 14, 2021
@isontheline
Copy link

@litherum I have applied a quick workaround on my own SSH app (now using Xterm.js).

A simple fix could be :
wkWebView.customUserAgent = @"Anything Safari";

Then the WebGL rendering is disabled and the terminal works as it should.

@Tyriar
Copy link
Member

Tyriar commented Jan 26, 2022

Yeah we check for "safari" in the user agent right now: #3357 (comment)

This just needs someone with a device that can verify a fix works for the webkit webview and doesn't break Chrome, etc. since user agents are a mess.

Tyriar added a commit to Tyriar/xterm.js that referenced this issue Nov 8, 2022
This does not fix the issue where webkit browsers cannot use it, I looked
at webkit versions in safari and was a bit confused. The wikipedia page
for safari shows v15 having webkit v612+ but I have safari v16 and it's
webkit v605, so trying to detect it based on webkit version is a risky
change.

Fixes xtermjs#3357
Related xtermjs#3575
Related microsoft/vscode#165416
Tyriar added a commit to Tyriar/xterm.js that referenced this issue Nov 8, 2022
This does not fix the issue where webkit browsers cannot use it, I looked
at webkit versions in safari and was a bit confused. The wikipedia page
for safari shows v15 having webkit v612+ but I have safari v16 and it's
webkit v605, so trying to detect it based on webkit version is a risky
change.

Note that webgl2 shipped in safari 15, but it didn't work in webgl until
safari 16.

Fixes xtermjs#3357
Related xtermjs#3575
Related microsoft/vscode#165416
@daonb
Copy link

daonb commented Jan 23, 2023

I believe this can be close now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser/safari Only affects Apple Safari help wanted type/bug Something is misbehaving
Projects
None yet
Development

No branches or pull requests

4 participants