Fix: force x-safari scheme for Linkedin app#3392
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 constructedx-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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/, theopen-in-safari://instead works.Forced the right scheme.
Implementation details
Testing Instructions (or ideally a Blueprint)