Javascript equivalent to $_SERVER['http_host']
Posted: Tue Jul 25, 2006 7:18 am
Is there a Javascript equivalent to $_SERVER['http_host'] or $_SERVER[''SERVER_ADDR' ]?
i.e for use with:
I have an ajax script that can occasionally fail because if a user types in http://www.thedomain.com it resolves to http://thedomain.com but if they've clicked a link from say another site, it correctly loads as http://www.thedomain.com.
The XMLHttpRequest gets confused and won't work for both. It would also be nice not to have to change the domain settings when I test the script locally.
i.e for use with:
Code: Select all
http.open('get', 'http://www.the domain.com/survey/rpc.php?action='+action);The XMLHttpRequest gets confused and won't work for both. It would also be nice not to have to change the domain settings when I test the script locally.