Skip to content

Commit bba083f

Browse files
committed
fix(templates): correct hash handling for redirects in redirect.html
1 parent 2f0b092 commit bba083f

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

templates/redirect.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1-
<noscript><meta http-equiv="refresh" content="0; url={{ url }}"/></noscript>
2-
<script>window.location = '{{ url }}' + window.location.hash;</script>
1+
<noscript><meta http-equiv="refresh" content="0; url={{ url }}"/></noscript>{#
2+
(function() {
3+
var url = '{{ url }}';
4+
var hash = window.location.hash;
5+
6+
if (hash) {
7+
var i = url.indexOf('#');
8+
if (i !== -1) url = url.substring(0, i); // remove existing hash 'to: /..../#anchor'
9+
url += hash;
10+
}
11+
12+
window.location = url;
13+
})();
14+
#}<script>(function(){var n,i="{{ url }}",o=window.location.hash;o&&(-1!==(n=i.indexOf("#"))&&(i=i.substring(0,n)),i+=o),window.location=i})();</script>
315
<meta http-equiv="refresh" content="1; url={{ url }}"/>

0 commit comments

Comments
 (0)