Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
merge
  • Loading branch information
kevmoo committed Nov 8, 2023
commit 000b98689c8c08ce82d8052a196bcb95ae9eab85
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,22 @@ class UrlLauncherPlugin extends UrlLauncherPlatform {
/// Returns the newly created window.
@visibleForTesting
html.Window? openNewWindow(String url, {String? webOnlyWindowName}) {
// We need to open mailto, tel and sms urls on the _top window context on safari browsers.
// See https://github.com/flutter/flutter/issues/51461 for reference.
final String? scheme = _getUrlScheme(url);
// Actively disallow opening some schemes, like javascript.
// See https://github.com/flutter/flutter/issues/136657
if (_isDisallowedScheme(scheme)) {
if (kDebugMode) {
print('Disallowed URL with scheme: $scheme');
}
return null;
}
// Some schemes need to be opened on the _top window context on Safari.
// See https://github.com/flutter/flutter/issues/51461
final String target = webOnlyWindowName ??
((_isSafari && _isSafariTargetTopScheme(url)) ? '_top' : '');
return _window.open(url, target);
((_isSafari && _isSafariTargetTopScheme(scheme)) ? '_top' : '');

// ignore: unsafe_html
return _window.open(url, target, 'noopener,noreferrer');
}

@override
Expand Down
2 changes: 1 addition & 1 deletion packages/url_launcher/url_launcher_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies:
sdk: flutter
flutter_web_plugins:
sdk: flutter
url_launcher_platform_interface: ^2.0.3
url_launcher_platform_interface: ^2.2.0
web: ^0.3.0

dev_dependencies:
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.