Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit60855a5

Browse files
authored
Merge pull request#312 from coderoad/fix/webview-error
Fix/webview error
2 parentse8d10b8 +dca8adf commit60855a5

File tree

1 file changed

+50
-20
lines changed

1 file changed

+50
-20
lines changed

‎web-app/public/index.html

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
<!DOCTYPE html>
22
<htmllang="en">
3-
4-
<head>
5-
<metacharset="utf-8"/>
6-
<metaname="viewport"content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
7-
<metaname="theme-color"content="#000000"/>
8-
<!--
3+
<head>
4+
<metacharset="utf-8"/>
5+
<metaname="viewport"content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
6+
<metaname="theme-color"content="#000000"/>
7+
<!--
98
manifest.json provides metadata used when your web app is added to the
109
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
1110
-->
12-
<linkrel="manifest"href="manifest.json"/>
13-
<linkrel="shortcut icon"href="favicon.ico"/>
14-
<!--
11+
<linkrel="manifest"href="manifest.json"/>
12+
<linkrel="shortcut icon"href="favicon.ico"/>
13+
<!--
1514
Notice the use of %PUBLIC_URL% in the tags above.
1615
It will be replaced with the URL of the `public` folder during the build.
1716
Only files inside the `public` folder can be referenced from the HTML.
@@ -20,15 +19,47 @@
2019
work correctly both with client-side routing and a non-root public URL.
2120
Learn how to configure a non-root public URL by running `npm run build`.
2221
-->
23-
<title>CodeRoad</title>
24-
</head>
22+
<title>CodeRoad</title>
23+
<script>
24+
// script must load in the header to work
25+
window.onerror=function(){
26+
// an error bubbled up
27+
// cannot detect error message as it runs in a different script
28+
consttargetElement=document.getElementById('coderoad-message')
29+
30+
if(targetElement){
31+
// setup failed, display an error message
32+
document.body.style.padding='1rem'
33+
document.body.style.border='0.5rem solid #FFBABA'
2534

26-
<body>
27-
<noscript>
28-
You need to enable JavaScript to run this app.
29-
</noscript>
30-
<divid="root"></div>
31-
<!--
35+
constdescription=document.createElement('p')
36+
description.textContent=
37+
'Try reloading VSCode, if the problem persists please report the error so we can get it fixed at'
38+
description.style.marginTop='1rem'
39+
description.style.padding='1rem'
40+
constlink=document.createElement('a')
41+
link.href='https://github.com/coderoad/coderoad-vscode/issues'
42+
link.textContent='github.com/coderoad/coderoad-vscode'
43+
// append description & link
44+
targetElement.textContent='Failed to load.'
45+
targetElement.append(description)
46+
description.append(document.createElement('br'))
47+
description.append(link)
48+
}
49+
}
50+
</script>
51+
</head>
52+
53+
<body>
54+
<divid="root">
55+
<divstyle="position: absolute; top: 33%; left: 0; right: 0; text-align: center;">
56+
<h1>CodeRoad</h1>
57+
<h3id="coderoad-message">
58+
Loading...
59+
</h3>
60+
</div>
61+
</div>
62+
<!--
3263
This HTML file is a template.
3364
If you open it directly in the browser, you will see an empty page.
3465
@@ -38,6 +69,5 @@
3869
To begin the development, run `npm start` or `yarn start`.
3970
To create a production bundle, use `npm run build` or `yarn build`.
4071
-->
41-
</body>
42-
43-
</html>
72+
</body>
73+
</html>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp