I think var newUrl = oldUrl.toLowerCase;
should be var newUrl = oldUrl.toLowerCase();
, since it is a function.
Why doesn't this code convert the URL to lowercase?
-
15-10-2022 - |
문제
This is in my 404.shtml file
<script> var oldUrl = window.location.href; var newUrl = oldUrl.toLowerCase; location.href = newUrl; </script>
해결책
다른 팁
toLowerCase
is a function so needs ()
:
<script>
var oldUrl = window.location.href;
var newUrl = oldUrl.toLowerCase();
location.href = newUrl;
</script>
제휴하지 않습니다 StackOverflow