Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (47.6k points)

All I want is to get the website URL. Not the URL as taken from a link. On the page loading, I need to be able to grab the full, current URL of the website and set it as a variable to do with as I please.

1 Answer

0 votes
by (106k points)

For getting the current URL with JavaScript you can use the following method:

window.location.href

You can also use document.URL; but it won’t work for Firefox.

You can also visit the following link for further knowledge URL of type DOMString, read-only.

Related questions

0 votes
1 answer
asked Aug 13, 2019 in Web Technology by Sammy (47.6k points)
0 votes
1 answer
asked Aug 10, 2019 in Web Technology by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer
asked Sep 30, 2019 in Java by Anvi (10.2k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...