Take a look at the following code:
<!--begin of index.html-->
<a href="#" id='click'>Click to change url to Index2.html</a>
<script type="text/javascript">
var stateObj = { foo: "bar" };
function change_my_url()
{
history.pushState(stateObj, "page 2", "http://MyDomain.com/Index2.html");
}
var link = document.getElementById('click');
link.addEventListener('click', change_my_url, false);
</script>
<!--end of index.html-->
This one is the sample script to change the URL without reloading the page.
The script successfully updates the URL from http://mydomain.com/index.html to http://mydomain.com/Index2.html without reloading the page. But, though in the updated URL, the filename is capitalized as mentioned in the code, the Domain name is not capitalized. I want the URL to look like http://MyDomain.com/Index2.html. Is this possible?
I know that my assumption that this script will capitalize domain name is wrong. But I just gave you an example of my efforts to Capitalizing a domain name in a URL using Javascript.