回答編集履歴
2
chousei
test
CHANGED
@@ -3,27 +3,29 @@
|
|
3
3
|
一応私の案に少し興味がありそうですので、具体的にはこんなかんじ
|
4
4
|
```javascript
|
5
5
|
<script>
|
6
|
-
window.addEventListener('popstate', (
|
6
|
+
window.addEventListener('popstate', ()=>{
|
7
7
|
history.pushState(null, null, null);
|
8
8
|
});
|
9
9
|
window.addEventListener('DOMContentLoaded', ()=>{
|
10
|
+
const dlg=document.querySelector('dialog');
|
10
11
|
history.pushState(null, null, null);
|
11
12
|
btn.addEventListener('click',()=>{
|
12
13
|
history.go(-2);
|
13
14
|
});
|
14
|
-
d
|
15
|
+
dlg.addEventListener('close', () => {
|
15
|
-
if(
|
16
|
+
if(dlg.returnValue!="ok" ){
|
16
|
-
d
|
17
|
+
dlg.showModal();
|
17
18
|
}
|
18
19
|
});
|
19
|
-
d
|
20
|
+
dlg.showModal();
|
20
21
|
});
|
21
22
|
</script>
|
22
23
|
<dialog>
|
23
24
|
<form method="dialog">
|
24
|
-
OKボタンを
|
25
|
+
OKボタンを推してください
|
25
26
|
<button type="submit" value="ok">OK</button>
|
26
27
|
</form>
|
27
28
|
</dialog>
|
28
29
|
<input type="button" id="btn" value="btn">
|
30
|
+
|
29
31
|
```
|
1
chousei
test
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
history.pushState(null, null, null);
|
8
8
|
});
|
9
9
|
window.addEventListener('DOMContentLoaded', ()=>{
|
10
|
-
history.pushState(null, null,
|
10
|
+
history.pushState(null, null, null);
|
11
11
|
btn.addEventListener('click',()=>{
|
12
12
|
history.go(-2);
|
13
13
|
});
|