-1

I'm trying to get the full url adress of the curent page using html and javascript. But I'm don't really good at web languages so I call for you're help.

Here is what I'm trying:

Your website url is: <script>(window.location.host)</script>

http://jsfiddle.net/5U366/92/

0

1 Answer 1

1

The way you could do it (not recommended is)

Your website url is: <script>document.write(window.location.host)</script>

better way would be to put a placeholder there and replace the content with innerHTML/textContent.

Your website url is: <span id="loc"></span>
<script>document.getElementById("loc").textContent = window.location.host;</script>
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much sir! It works and it is all what I wanted. Edit. Haha. Thank you again for such a fast respone and for solving my problem!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.