Skip to content

Commit

Permalink
Use historyBackOrDefault() to the JA/EN back buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
yasulab committed Jan 2, 2025
1 parent 79bfb88 commit f327126
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
16 changes: 15 additions & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,21 @@ <h1>404</h1>
<div><img src="/assets/img/spinner.svg" data-src="/assets/img/404.webp" alt="404 Page Not Found" width="200px" style="margin-top: -50px;" class="lazyload" /></div>
<span>リンク切れの場合は <a href="https://twitter.com/MitouJr">@MitouJr</a> までご連絡して頂けると嬉しいです。</span>

<p><a href="javascript:history.back()">« 戻る</a></p>
<script type="text/javascript">
function historyBackOrDefault() {
console.log(history.length);
if (history.back() === undefined ) {
if (window.location.href.indexOf("/english") != -1) {
window.location.replace("/english");
} else {
window.location.replace("/");
}
} else {
history.back();
}
}
</script>
<p><a href="javascript:historyBackOrDefault()">« 戻る</a></p>

<div style='margin-top: 100px;'>
<a class="twitter-timeline" data-lang="ja" data-height="700"
Expand Down
17 changes: 16 additions & 1 deletion english/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,22 @@ <h1>404</h1>
<div><img src="/assets/img/spinner.svg" data-src="/assets/img/404_en.webp" alt="404 Page Not Found" width="200px" style="margin-top: -50px;" class="lazyload" /></div>
<span>Contact <a href="https://twitter.com/MitouJr">@MitouJr</a> if this is an erorr to report.</span>

<p><a href="javascript:history.back()">« Back</a></p>
<script type="text/javascript">
function historyBackOrDefault() {
console.log(history.length);
if (history.back() === undefined ) {
if (window.location.href.indexOf("/english") != -1) {
window.location.replace("/english");
} else {
window.location.replace("/");
}
} else {
history.back();
}
}
</script>

<p><a href="javascript:historyBackOrDefault()">« Back</a></p>

<div style='margin-top: 100px;'>
<a class="twitter-timeline" data-lang="en" data-height="700"
Expand Down

0 comments on commit f327126

Please sign in to comment.