Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the website root in Javascript

say I'm developing a website.com. I need to get the root (website.com) dynamically (for dev and production). Is there a way to do it in JS?

I am using asp.net mvc 3 on the server.

like image 473
sarsnake Avatar asked Aug 09 '26 11:08

sarsnake


1 Answers

Yes: window.location.hostname

like image 146
Audun Larsen Avatar answered Aug 10 '26 23:08

Audun Larsen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!