Window alert() Method - Alert the hostname of the current URL: - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window alert

Description

Window alert() Method - Alert the hostname of the current URL:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {//from ww w.  java2  s . com
    console.log(location.hostname);
}
</script>

</body>
</html>

Related Tutorials