We Recommend

Building Websites with TYPO3 Building Websites with TYPO3
Follow a clear path through the power and complexity of TYPO3 to get started, and build your own TYPO3 website This book is a fast paced tutorial to creating a website using TYPO3. If you have never used TYPO3, or even any web content management system before, then you need not look further than this book as it walks you through each step to create your own TYPO3 site.


Posted By

vanne on 04/18/07


Tagged

javascript


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

vali29


Retrieve domain name in javascript


Published in: Other 


  1. var domain = "http://" + window.location.toString().split("//")[1].split("/")[0] + "/";

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: remysharp on May 10, 2007

Or:

var domain = 'http://' + window.location.hostname + '/';

Posted By: vanne on March 4, 2008

That's even better thanks!

You need to login to post a comment.