如果主机名与父级和子级相同,我正在尝试关闭子窗口,但它的
<script type="text/javascript">
$(document).ready(function () {
if (window.opener) {
if (window.opener.location.indexOf(document.location.hostname) != -1) {
window.opener.location = window.location;
window.close();
}
}
});
</script>
并得到这个错误
Error: window.opener.location.indexOf is not a function
Source File: https://example.com/default
Line: 100