Catch domain via Node/Vue.js

Asked

Viewed 93 times

-1

I simply want to show the domain that appears there in the URL when accessing the page.

window.location.hostname Give me this, only it doesn’t work on Node/Vue.js, so what would be the solution?

  • Luciano, if any answer has solved your problem you can mark as accepted by clicking on the green V side of the chosen points. Or, if you want, you can leave it open for a while if you want more alternatives, but it is good that after it is resolved you mark some to close the subject. Learn more in "How and why to accept an answer".

1 answer

3

I do not understand your question, even because it is not clear enough. But to get the domain you can use a Javascript property that returns the domain of the page.

document.domain

By running this on the console of only you will get the following return:

"pt.stackoverflow.com"

For more information you can access this documentation by clicking here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.