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
Post a Comment