I've tried every javascript method I know to figure out what the domain is. I need the form to react differently on a button press, based on what site it was opened within. So far nothing works, and I can only find documentation on how to determine if the client is Reader, or a browser. That doesn't help me however.
Asked
Active
Viewed 249 times
1 Answers
0
The in
operator is pretty spiffy...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>JavaScript Domain</title>
<script type="application/javascript">
//<![CDATA[
window.onload = function(e)
{
for (i in window.location) {alert('i = '+i);}
alert(window.location.host);
alert(window.location.hostname);
}
//]]>
</script>
</head>
<body>
<div><p>JavaScript Domain</p></div>
</body>
</html>

John
- 1
- 13
- 98
- 177