我已经尝试了我所知道的所有 JavaScript 方法来找出域是什么。我需要表单根据打开的网站在按下按钮时做出不同的 react 。到目前为止,没有任何效果,我只能找到有关如何确定客户端是 Reader 还是浏览器的文档。但这对我没有帮助。
最佳答案
in
运算符非常漂亮...
<?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>
关于javascript - Adobe 动态表单 : Javascript to find URL domain the form is open under,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18156203/