Skip to content

Fix: force x-safari scheme for Linkedin app#3392

Merged
zaerl merged 3 commits into
trunkfrom
fix/force-x-safari-scheme-ln-app
Mar 13, 2026
Merged

Fix: force x-safari scheme for Linkedin app#3392
zaerl merged 3 commits into
trunkfrom
fix/force-x-safari-scheme-ln-app

Conversation

@zaerl

@zaerl zaerl commented Mar 13, 2026

Copy link
Copy Markdown
Collaborator

Motivation for the change, related issues

The x-safari-http(s):// scheme doesn't work in a WKWebView running in iOS simulator when running http://127.0.0.1:5400/website-server/, the open-in-safari:// instead works.

Forced the right scheme.

Implementation details

Testing Instructions (or ideally a Blueprint)

@zaerl zaerl requested review from a team, ashfame and Copilot March 13, 2026 23:06
@zaerl zaerl self-assigned this Mar 13, 2026
@zaerl zaerl requested a review from brandonpayton March 13, 2026 23:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the iOS “Open in your browser” behavior to use the x-safari-https:// URL scheme (intended to work around LinkedIn in-app browser behavior) instead of open-in-safari://.

Changes:

  • Replaces open-in-safari:// with a constructed x-safari-https://{host}{path}{query}{hash} URL in two playground HTML pages.
  • Adds context comments explaining different behavior in iOS simulator vs in-app browsers (website page).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
packages/playground/website/index.html Switches Safari deep link to x-safari-https://… and adds rationale/comments.
packages/playground/personal-wp/index.html Switches Safari deep link to x-safari-https://… using the same URL construction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +182 to +187
safariLink.href =
'x-safari-https://' +
window.location.host +
window.location.pathname +
window.location.search +
window.location.hash;
@@ -166,14 +166,25 @@ <h1>Open in your browser</h1>
);

if (/Twitter for iPhone/i.test(ua)) {
Comment on lines +178 to +182
// when running http://127.0.0.1:5400/website-server/, the `open-in-safari://` instead works,
// but not in other environments.
// This is tested with the Linkedin mobile app.
// TODO: test with other mobile apps.
safariLink.href =
Comment on lines +173 to +178
safariLink.href =
'x-safari-https://' +
window.location.host +
window.location.pathname +
window.location.search +
window.location.hash;
Comment on lines 171 to 175
safariLink.removeAttribute('href');
safariLink.addEventListener('click', function (e) {
e.preventDefault();
navigator.share({ url: window.location.href });
});
// The `x-safari-http(s)://` scheme doesn't work in a WKWebView running in iOS simulator
// when running http://127.0.0.1:5400/website-server/, the `open-in-safari://` instead works,
// but not in other environments.
// This is tested with the Linkedin mobile app.

@brandonpayton brandonpayton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 thank you!

@zaerl zaerl merged commit 6fe79a4 into trunk Mar 13, 2026
43 checks passed
@zaerl zaerl deleted the fix/force-x-safari-scheme-ln-app branch March 13, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants