Created
March 18, 2015 19:54
-
-
Save brandanmajeske/9ab89246b7a341a1f7bf to your computer and use it in GitHub Desktop.
URL rewrite to lower with JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
var URL=document.location; | |
//This makes the URL become a string, without it, an error would | |
//occur. | |
URL+=""; | |
if(URL.toLowerCase() != URL){ //Check if the URL needs modified | |
//If so, then replace it. | |
document.location.replace(URL.toLowerCase()); | |
//I used replace because I didn't want the user to hit the | |
//back button and then hit the URL that they came from, thus | |
//returning them to the same place. | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment