Skip to content

Commit 786cb33

Browse files
DanTupkenzieschmoll
authored andcommitted
Improve experience in Internet Explorer + tweak Edge message (#542)
* Redirect browsers that don't support ES6 classes to an unsupported page This will catch really old browsers like IE. * Change name for IE since it includes Edge too
1 parent c184f9b commit 786cb33

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

packages/devtools/web/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@
2323
<link rel="stylesheet" href="packages/devtools/src/timeline/timeline.css">
2424

2525
<script type="text/javascript">
26+
function supportsES6Classes() {
27+
"use strict";
28+
try { eval("class Foo {}"); }
29+
catch (e) { return false; }
30+
return true;
31+
}
32+
33+
if (!supportsES6Classes()) {
34+
window.location.href = '/unsupported-browser.html';
35+
}
36+
2637
(function() {
2738
var params = new URLSearchParams(window.location.search);
2839
if (params.get('theme') == 'dark') {

packages/devtools/web/main.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ void main() {
1414
final PerfToolFramework framework = PerfToolFramework();
1515

1616
if (!browser.isChrome) {
17+
final browserName =
18+
// Edge shows up as IE, so we replace it's name to avoid confusion.
19+
browser.isInternetExplorer || browser == Browser.UnknownBrowser
20+
? 'an unsupported browser'
21+
: browser.name;
1722
framework.disableAppWithError(
18-
'ERROR: You are running DevTools on '
19-
'${browser.name == Browser.UnknownBrowser.name ? 'an unknown browswer' : browser.name}, '
23+
'ERROR: You are running DevTools on $browserName, '
2024
'but DevTools only runs on Chrome.',
2125
'Reopen this url in a Chrome browser to use DevTools.',
2226
);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Dart DevTools - Unsupported Browser</title>
5+
<style>
6+
body {
7+
margin: 50px 30px;
8+
font-family: "Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
9+
}
10+
</style>
11+
</head>
12+
<body>
13+
<h1>Unsupported Browser</h1>
14+
<p>Your browser is not supported by DevTools. Please try using Google Chrome.</p>
15+
</body>
16+
</html>

0 commit comments

Comments
 (0)