質問編集履歴
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -234,6 +234,8 @@
|
|
234
234
|
|
235
235
|
### 補足情報(FW/ツールのバージョンなど)
|
236
236
|
|
237
|
-
|
237
|
+
別のjsファイルを作り、試したところ、普通に関数を呼び出すことができました。
|
238
|
-
|
238
|
+
|
239
|
-
|
239
|
+
firebaseのmain.jsが何か引っかかっているようです。
|
240
|
+
|
241
|
+
microsoft edgeでは、main.jsでもできたのに対して、chromeでローカルサーバーで動かしてみると、上記のような事になるところまでは発見しましたが、それ以上はよく分かりません。
|
1
ソースコードを載せました
test
CHANGED
File without changes
|
test
CHANGED
@@ -64,13 +64,163 @@
|
|
64
64
|
|
65
65
|
### 該当のソースコード
|
66
66
|
|
67
|
-
|
67
|
+
<!DOCTYPE html>
|
68
|
+
|
68
|
-
|
69
|
+
<html lang="ja">
|
70
|
+
|
71
|
+
|
72
|
+
|
69
|
-
|
73
|
+
<head>
|
74
|
+
|
70
|
-
|
75
|
+
<meta charset="utf-8">
|
76
|
+
|
77
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
78
|
+
|
79
|
+
<title>NoteWeb-App</title>
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
<!-- call jquery frame -->
|
84
|
+
|
85
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
<!-- update the version number as needed -->
|
90
|
+
|
91
|
+
<script defer src="/__/firebase/7.6.0/firebase-app.js"></script>
|
92
|
+
|
93
|
+
<!-- include only the Firebase features as you need -->
|
94
|
+
|
95
|
+
<script defer src="/__/firebase/7.6.0/firebase-auth.js"></script>
|
96
|
+
|
97
|
+
<script defer src="/__/firebase/7.6.0/firebase-database.js"></script>
|
98
|
+
|
99
|
+
<script defer src="/__/firebase/7.6.0/firebase-messaging.js"></script>
|
100
|
+
|
101
|
+
<script defer src="/__/firebase/7.6.0/firebase-storage.js"></script>
|
102
|
+
|
103
|
+
<!-- initialize the SDK after all desired features are loaded -->
|
104
|
+
|
105
|
+
<script defer src="/__/firebase/init.js"></script>
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<script type="text/javascript" src='main.js'></script>
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
</head>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<body>
|
118
|
+
|
119
|
+
<h1>Hello</h1>
|
120
|
+
|
121
|
+
<div id="user-name">No-User</div>
|
122
|
+
|
123
|
+
<input id="login-button" type="image" src="UI/signinImage.png" alt="LOGIN">
|
124
|
+
|
125
|
+
<br>
|
126
|
+
|
127
|
+
<input id="opennote-button" type="button" onclick="openNote()" value="Open Note">
|
128
|
+
|
129
|
+
</body>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
</html>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
------------------------------------------------------------------
|
138
|
+
|
139
|
+
var signinCompleted = false;
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
function openNote() {
|
144
|
+
|
145
|
+
console.log("open judge -> "+signinCompleted)
|
146
|
+
|
147
|
+
if (signinCompleted) {
|
148
|
+
|
149
|
+
location.href = "./note.html";
|
150
|
+
|
71
|
-
|
151
|
+
}else{
|
152
|
+
|
72
|
-
|
153
|
+
console.log("Signin if you want to open note");
|
154
|
+
|
155
|
+
}
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
window.onload = function () {
|
162
|
+
|
163
|
+
var loginButton = document.getElementById("login-button");
|
164
|
+
|
165
|
+
var username = this.document.getElementById("user-name");
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
loginButton.addEventListener("click", event => {
|
170
|
+
|
171
|
+
var provider = new firebase.auth.GoogleAuthProvider();
|
172
|
+
|
173
|
+
this.console.log("aaa");
|
174
|
+
|
175
|
+
firebase.auth().signInWithPopup(provider).then(function (result) {
|
176
|
+
|
177
|
+
console.log("func on");
|
178
|
+
|
179
|
+
signinCompleted = true;
|
180
|
+
|
181
|
+
username.innerHTML = result.user.displayName;
|
182
|
+
|
183
|
+
// This gives you a Google Access Token. You can use it to access the Google API.
|
184
|
+
|
185
|
+
var token = result.credential.accessToken;
|
186
|
+
|
187
|
+
// The signed-in user info.
|
188
|
+
|
189
|
+
var user = result.user;
|
190
|
+
|
191
|
+
})
|
192
|
+
|
193
|
+
.catch(function (error) {
|
194
|
+
|
195
|
+
console.log(error);
|
196
|
+
|
197
|
+
// Handle Errors here.
|
198
|
+
|
199
|
+
var errorCode = error.code;
|
200
|
+
|
201
|
+
var errorMessage = error.message;
|
202
|
+
|
203
|
+
// The email of the user's account used.
|
204
|
+
|
205
|
+
var email = error.email;
|
206
|
+
|
207
|
+
// The firebase.auth.AuthCredential type that was used.
|
208
|
+
|
209
|
+
var credential = error.credential;
|
210
|
+
|
211
|
+
// ...
|
212
|
+
|
73
|
-
|
213
|
+
});
|
214
|
+
|
215
|
+
});
|
216
|
+
|
217
|
+
};
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
74
224
|
|
75
225
|
|
76
226
|
|