url - How to retrieve domain name via javascript? -


when used below script in www.example.com/about-us/user , showed entire url

<script type="text/javascript">      alert(document.url); </script> 

i want domain name in here,say example.com .. there javascript inbuilt function retrieving domain name?

it's simple as:

 alert(document.domain); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -