Location.hostname
In this chapter you will learn:
Host name
The hostname
property can be set with new
values that alter the current URL.
Assume starting at http://www.java2s.com/index.htm,
location.hostname = "java2s.com";
changes URL to "http://java2s.com/index.htm"
<!DOCTYPE HTML> /*from j av a 2 s .co m*/
<html>
<body>
<script>
location.hostname = "java2s.com";
</script>
</body>
</html>
Next chapter...
What you will learn in the next chapter: