Skip to content

Commit bd399e1

Browse files
author
Anna Gringauze
authored
Use window.navigator.vendor to detect chromium-based browsers (#1449)
* Use window.navigator.vendor to detect chromium-based browsers Previously we used `window.navigator.userAgent` to detect if the browser is chromium-based, but that detection fails during iphone simulation in chrome or egde. Change the detection to use `window.navigator.vendor` instead. CLoses: flutter/flutter#92567 * Update changelog
1 parent 8f4de46 commit bd399e1

File tree

3 files changed

+32
-11
lines changed

3 files changed

+32
-11
lines changed

dwds/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
used by DDR, and is not yet supported for amd modules that are used by
1212
flutter tools and webdev.
1313

14+
- Fix chrome detection in iPhone emulation mode in chrome or edge browsers.
15+
1416
## 11.4.0
1517

1618
- Fix duplicated scripts returned by `VmService.getScripts` API.

dwds/lib/src/injected/client.js

Lines changed: 29 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dwds/web/client.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,4 @@ external set emitDebugEvent(void Function(String, String) func);
223223
@JS(r'$emitRegisterEvent')
224224
external set emitRegisterEvent(void Function(String) func);
225225

226-
bool get _isChromium => window.navigator.userAgent.contains('Chrome');
226+
bool get _isChromium => window.navigator.vendor.contains('Google');

0 commit comments

Comments
 (0)